activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mholodnak <michael.holod...@thermofisher.com>
Subject Newbie confusion regarding JNDI configuration
Date Fri, 24 Sep 2010 19:53:08 GMT

I explicitly created a Topic named "agility_event_topic_d2" using the default
web admin tool.  My message producer appears to successfully (i.e. without
Exception) post messages to my topic.  However, my consumer never finds any
and the default admin tool indicates that no messages are being sent.

This would indicate that my producer is not actually sending messages to my
topic, likely due to a configuration error.  Here is my producer JNDI
configuration per the JNDI example page:

# JNDI context properties
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=tcp://uspgh-agljms-p1.amer.thermo.com:61616?jms.watchTopicAdvisories=false

# JMS resources; I prefer to look these up explicitly instead of using the 
# automated properties
#jms.connection.factory=connectionFactory
#jms.topic=agility_event_topic_d2

# use the following property to specify the JNDI name the connection factory
# should appear as. 
connectionFactoryNames=connectionFactory, queueConnectionFactory,
topicConnectionFactory

# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
#queue.MyQueue = example.MyQueue


# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.ForwardTopic=agility_event_topic_d2

Here is the chunk of code that produces the message (its in an MDB deployed
in WebLogic that listens to a queue then forwards messages from that
WebLogic Queue to the ActiveMQ Topic):

	public void onMessage(Message message)
	{
		logger.info("Starting 'onMessage("+message.getClass().getName()+")'");
		try
		{
			this.connection.start();
			this.session = this.connection.createTopicSession(true,
TopicSession.AUTO_ACKNOWLEDGE);
			try
			{
				TopicPublisher publisher = this.session.createPublisher(topic);
				//publisher.send(message);
				publisher.publish(message);
				
				this.session.commit();
				this.session.close();
				this.connection.stop();
				this.connection.close();
				
				logger.info("Successfully posted message of type
"+message.getClass().getName());
			}
			catch (Exception ex)
			{
				logger.warn("Error forwarding message.", ex);
				this.session.rollback();
			}
		}
		catch (Exception ex)
		{
			String messageStr = "A fatal JMS exception has occured while trying to
access JMS objects";
			logger.error(messageStr, ex);
			throw new RuntimeException(messageStr, ex);
		}
		
		logger.info("Completed 'onMessage("+message.getClass().getName()+")'");
	}


-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Newbie-confusion-regarding-JNDI-configuration-tp2582968p2582968.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message