Configuring the HornetQ Embedded Remote Device Example

I am having some problems indicating an example in hornetq-2.3.0.Final jar in the main folder named Embedded-Remote, I am trying to run the example in a "remote environment", using for these two computers on the same local network, if I launched two classes without changing anything on the same computer, "EmbeddedRemotExample.java" works fine, but since there are no configuration files in this example, I'm not sure how to set this class to connect to a server running on another computer. after reading the api, I found that this is valid code:

`

HashMap map = new HashMap(); map.put("host", "192.168.XXX.XXX"); map.put("port", 5445); ServerLocator serverLocator = HornetQClient.createServerLocatorWithoutHA( new TransportConfiguration(NettyConnectorFactory.class.getName(),map)); ClientSessionFactory sf = serverLocator.createSessionFactory();` 

but this throws the following exception

 HornetQException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.] at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:852) at org.hornetq.core.example.EmbeddedRemoteExample.main(EmbeddedRemoteExample.java:49)` 

How can I customize this specific example?

on one computer: org.hornetq.core.example.EmbeddedServer

in another: org.hornetq.core.example.EmbeddedRemoteExample

+4
source share
1 answer

You need to add the same configuration to the Acceptor server in EmbeddedServer.java . By default, it will be installed on localhost.

I believe this example needs to clear the code:

https://github.com/hornetq/hornetq/pull/1062

In this particular commit, it will be clear that you need to change:

https://github.com/FranciscoBorges/hornetq/commit/fbed7e8394c843e4528df90d4c2ef155a7d032c0

+5
source

Source: https://habr.com/ru/post/1481049/


All Articles