BTW - setting the destination directly on the message doesn't do
anything
and could you try an ping the host name your trying to connect to ? -
looks like you don't have a host called remotehost on your network :)
On 27 Jun 2006, at 10:45, kirkal wrote:
hi
thanks for the reply....
i think its part of a larger problem - i have AMQ 4.0 RC2 up and
running on
a system(remotehost) and am trying to send messages to a topic and
receive
messages from the topic using a simple pub/sub code beofre i
proceed to
anything further. however, the topicconsume code keeps returning a
"Received:null " as the result. what do i do? the code fragments
are as
shown below:
TopicPublish.java
Context ctx = new InitialContext();
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://remotehost:61616");
Connection connection =
connectionFactory.createConnection();
connection.start();
TopicSession topicSession = ((TopicConnection)
connection).createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
Topic destination = topicSession.createTopic("TEST.FOO");
TopicPublisher topicPublisher = topicSession.createPublisher
(destination);
System.out.println("Sample application publishing a message to a
topic.");
for ( int i=0;i<10;i++)
{
TextMessage message = topicSession.createTextMessage("Hello
world");
message.setJMSDestination(destination);
topicPublisher.publish(message);
topicPublisher.publish(destination,message);
topicPublisher.send(destination,message);
System.out.println(topicPublisher.getDestination());
System.out.println(message);
topicPublisher.publish(destination,message);
}
// clean up
topicPublisher.close();
topicSession.close();
connection.close();
}
TopicConsume.java
Same setup as before
Topic destination = topicSession.createTopic("TEST.FOO");
MessageConsumer consumer =
topicSession.createDurableSubscriber(destination, null);
Message message = consumer.receive(1000);
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
String text = textMessage.getText();
System.out.println("Received: " + text);
} else {
System.out.println("Received: " + message);
}
By rights, this is such simple code that it should run with no
problems......it does not run, at all.
Eitehr the TopicConsume code crashes saying the host is
unreachable or
Reason: java.net.NoRouteToHostException: No route to host
I have no clue whaat to do here....even simple code like this
seems not to
work and i seem to find no documentation that helps.
any help / suggestions would be appreciated.
--
View this message in context: http://www.nabble.com/transport-
connector-problem-tf1847502.html#a5062872
Sent from the ActiveMQ - User forum at Nabble.com.