[jboss-user] [Messaging, JMS & JBossMQ] - Multiple innvocation for single object(Message) in Queue

evijayan2 do-not-reply at jboss.com
Tue May 8 06:31:41 EDT 2007


Hi Guyz,

I have a MDB running in two machines A and B, Queue is common for both MDB's.
Queue is residing on Machine A.

I posted 5 Objects(message) (eg. Obj1, Obj2, Obj3...Obj5) from Java client to Queue.

The onMessage part is designed to consume 2minutes for execution.

Both MDB's are  consuming messages parallel, but the consumed Objects(messages) is repeatedly picked up for execution by MDB's even after completion of the consumed message.

Pls suggest the working pattern of the MDB message handling.

Jboss Version 4.0.3.

	public void onMessage(Message msg){
		System.out.println("OnMessage is called............."+getTime());
		String countId="";
		try
		{
			ObjectMessage objMsg = (ObjectMessage)msg; 
			Count objCount = (Count)objMsg.getObject();
			countId=objCount.getOrderNumber();
			System.out.println("Message Received***********:"+countId);

			for (int i=0;i<5000;i++ ) {				
				for (int j=0;j<9999999;j++ ) {
					;
				}				
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		System.out.println("OnMessage is End process........."+getTime()+"*******"+countId);
	}

Jboss.xml
-----------

	<enterprise-beans>
		
		<message-driven>
			<ejb-name>TestMDB</ejb-name>
			<configuration-name>TestMDB</configuration-name> 
			<message-driven-destination>javax.jms.Queue</message-driven-destination>
			<destination-jndi-name>queue/CountTestQueue</destination-jndi-name>
		</message-driven>
</enterprise-beans>

	<container-configurations>

	<!-- Configurations for async count MDBs  -->
			<container-configuration>
			<container-name>TestMDB</container-name>
			<call-logging>false</call-logging>
			<container-invoker>org.jboss.ejb.plugins.jms.JMSContainerInvoker</container-invoker>
			<container-interceptors>
				org.jboss.ejb.plugins.LogInterceptor
				org.jboss.ejb.plugins.SecurityInterceptor
				<!-- CMT -->
				org.jboss.ejb.plugins.TxInterceptorCMT
				org.jboss.ejb.plugins.MetricsInterceptor
				org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
				<!-- BMT -->
				org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
				org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
				org.jboss.ejb.plugins.MetricsInterceptor
			</container-interceptors>
			<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
			<instance-cache/>
			<persistence-manager/>
			<transaction-manager>org.jboss.tm.TxManager</transaction-manager>
			<container-invoker-conf>
				<!-- RemoteJMSProvider -->
				DefaultJMSProvider 
				StdJMSPool
				2
				1
				True
			</container-invoker-conf>
			<container-cache-conf/>
			<container-pool-conf>
				2
				1
				true
			</container-pool-conf>
			<commit-option>B</commit-option>
			<role-mapping-manager/>
			<authentication-module/>
		    </container-configuration>
</container-configurations>


Pls check it and give correct suggestion



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

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



More information about the jboss-user mailing list