users@genericjmsra.java.net

Re: Sun MQ and MDB

From: George Tharakan <George.Tharakan_at_Sun.COM>
Date: Wed, 03 May 2006 10:15:06 -0700

As to the first Q - why does message.setIntProperty() generate an
Exception...
Upon receipt of a message, it is in read only mode.
The application must call msg.clearProperties() to write any properties;
for example before reusing the message to send to another Destination.

Same is the case when the msg is to be re-used w/ a different body;
msg.clearBody()must be called first.

See the javax.jms.Message javadoc at

http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Message.html

As to the 2nd Q - no, JMSDeliveryCount is not yet supported by the Sun
MQ JMS Provider.

A solution to your problem would be to handle this with a second
destination to which the message is sent after a certain (short)
interval during which you could not contact the service that needs to be
performed.

If the service availability is extremely spotty, with long durations of
unavailability, then asynchronous messaging via a MDBs is probably not
the correct application architecture. The more appropriate model would
be to use a synchronous receive in another Java EE component and pull
messages for processing from the Queue only when the service is available.

-George

J. Seah wrote:
> Well it is an ejb which generates the JMS message and sends it to the
> Sun MQ.
>
> Is there any facility for me to determine the redilivery count that the
> MDB has been trying to process?
>
> I've noticed that there is JMSDeliveryCount in the JMS specs but I don't
> think Sun MQ implements this though. I was hoping to create my own
> application specific JMS property in the message headers but I get teh
> error message as indicated below.
>
> Any ideas?
>
> thanks
>
>> From: Binod <Binod.Pg_at_Sun.COM>
>> Reply-To: users_at_genericjmsra.dev.java.net
>> To: users_at_genericjmsra.dev.java.net
>> Subject: Re: Sun MQ and MDB
>> Date: Tue, 02 May 2006 10:59:54 +0530
>>
>> I dont think you can do any thing with the incoming message.
>> If it is just for testing purpose, you might need to update a db with
>> a non transactional connection. For example, you can insert a
>> table whose key is message Id and value is number of deliveries.
>>
>> - Binod.
>>
>>> Hi All,
>>>
>>> I'm trying to use Sun MQ and MDBs. What happens is that we punch
>>> messages to Sun message queues. We have a MDB which reads of it and
>>> performs certain actions dependent on the message type. There is a
>>> possiblity that teh service that the MDB is reliant on could be down.
>>>
>>> What I want this MDB to do is try the dependeant service a few times
>>> and if not, it should throw it to Sun's dead message queue. How can I
>>> test the number of times it has been redelivered?
>>>
>>> I've been calling mdc.setRollbackOnly() to rollback the transaction.
>>>
>>> I've tried doing
>>>
>>> message.setIntProperty("count",count) but I get:
>>>
>>> [#|2006-05-02T13:17:06.790+0800|WARNING|sun-appserver-pe8.1_02|javax.enterprise.system.stream.err|_ThreadID=301;|
>>>
>>>
>>> javax.jms.MessageNotWriteableException: [C4011]: Write message failed.
>>> at
>>> com.sun.messaging.jmq.jmsclient.MessageImpl.checkAndSetProperty(MessageImpl.java:758)
>>>
>>>
>>> at
>>> com.sun.messaging.jmq.jmsclient.MessageImpl.setIntProperty(MessageImpl.java:1924)
>>>
>>>
>>> at
>>> au.gov.wa.police.webservice.mq.MQMessageBean.onMessage(Unknown Source)
>>> at sun.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>> at
>>> com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:950)
>>>
>>>
>>> at
>>> com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
>>> at
>>> com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:956)
>>>
>>>
>>> at
>>> com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:42)
>>>
>>>
>>> at
>>> com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:130)
>>>
>>>
>>> at $Proxy123.onMessage(Unknown Source)
>>> at
>>> com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:187)
>>> at
>>> com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:45)
>>> at
>>> com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:409)
>>>
>>>
>>> |#]
>>>
>>> any ideas?
>>>
>>> thanks in advanced
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_genericjmsra.dev.java.net
>>> For additional commands, e-mail: users-help_at_genericjmsra.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_genericjmsra.dev.java.net
>> For additional commands, e-mail: users-help_at_genericjmsra.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_genericjmsra.dev.java.net
> For additional commands, e-mail: users-help_at_genericjmsra.dev.java.net
>