[jboss-user] [JBoss Messaging] - Re: Problem publishing message from one Jboss server to anot

jhd do-not-reply at jboss.com
Tue Jul 8 13:17:37 EDT 2008


Here is the client code that is executed from either Server1 or Server2:


  | 	private void triggerSecurityReloadForLoginIds(HashSet loginIds)
  | 	{
  | 		if (loginIds.size() > 0)
  | 		{
  | 			TopicConnection topicConnection = null;
  | 			try
  | 			{
  | 				ServiceLocator sl = ServiceLocator.getInstance();
  | 
  | 				Context ctx = new InitialContext();
  | 				TopicConnectionFactory cf = (TopicConnectionFactory) ctx
  | 						.lookup("/ConnectionFactory");
  | 
  | 				topicConnection = cf.createTopicConnection();
  | 				TopicSession topicSession = topicConnection.createTopicSession(
  | 						false, Session.AUTO_ACKNOWLEDGE);
  | 
  | 				String remoteQueueHost = Env.getInstance()
  | 						.getJMSRemoteQueueHost();
  | 				ctx = sl.getInitialContext(remoteQueueHost);
  | 				String localTopicName = Env.getInstance()
  | 						.getReloadSecurityCacheTopicJndi();
  | 				Topic topic = (Topic) ctx.lookup(localTopicName);
  | 
  | 				ObjectMessage objectMessage = topicSession
  | 						.createObjectMessage();
  | 				TopicPublisher topicPublisher = topicSession
  | 						.createPublisher(topic);
  | 				objectMessage.setObject(loginIds);
  | 				topicPublisher.publish(objectMessage);
  | 				log
  | 						.info("triggerSecurityReloadForLoginIds sent reload message <"
  | 								+ objectMessage.getJMSMessageID()
  | 								+ "> - for logonIds: " + loginIds);
  | 			} catch (Exception e)
  | 			{
  | 				// just log the Exception
  | 				String msg = e.getMessage();
  | 				log.fatal(msg);
  | 			} finally
  | 			{
  | 				if (topicConnection != null)
  | 				{
  | 					try
  | 					{
  | 						topicConnection.close();
  | 					} catch (Exception e)
  | 					{
  | 					}
  | 				}
  | 			}
  | 		}
  | 
  | 	}
  | 

The value of "remoteQueueHost" is different when executed from Server1 or Server2.  The property is tokenized through our build process.  For Server1 "remoteQueueHost" = localhost.  For Server2 "remoteQueueHost" = Server1.

This code executes without errors from either Server1 or Server2 but the message is only propogated successfully from Server1.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163119#4163119

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163119



More information about the jboss-user mailing list