문제

Impedded Hornetq 코어에 대한 예제 다음에 OSGi 컨테이너에 포함 된 HornetQ 서버를 실행 중입니다.

3 개의 OSGi 컨테이너가 있습니다. 하나는 서버를위한 하나, 생산자 및 소비자를위한 마지막 하나입니다.모든 것이 로컬에서 작동합니다.

시스템에 연결하기위한 프로듀서 및 소비자가 모두 사용하는 코드는 다음과 같습니다.

// Step 4. As we are not using a JNDI environment we instantiate the objects directly
ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName()));
ClientSessionFactory sf = serverLocator.createSessionFactory();
.

TransportConfiguration 메소드를보고 시도했지만 setter는 발견되지 않았습니다.

도움이 되었습니까?

해결책

전송 구성에 매개 변수를 전달해야합니다.

Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("port", org.hornetq.core.remoting.impl.netty.TransportConstants
                      .DEFAULT_PORT);
parameters.put(TransportConstants.HOST_PROP_NAME, "127.0.0.1");

TransportConfiguration configuration = new TransportConfiguration(
        NettyConnectorFactory.class.getName(), parameters);
.

NettyAcceptor와 동일하게 할 수 있습니다.테스트에서 수락자를 구성하는 방법을 모르겠지만 아이디어를 얻길 바랍니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top