You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by gnanapandithan <m....@gmail.com> on 2017/07/26 01:52:31 UTC

IBM MQ Message property is null in MDB

I am publishing JMS text message to topic and consumer is able to consumer (
MDB ) the text message. But  not able to get *Message Object and String
property*. it is null in MDB consumer side. I have defined MDB in
ejb-jar.xml under META-INF folder. I am using 

TomEE plus 7.0.2
JMS 2.0
IBM MQ 8
JDK 1.8
Topic

I refereed below mentioned Tomee official example. In example they used
tomee.xml instead i used resource.xml and don't use web.xml

Consumer is MessageDrivenBean

Consumer is able to get Text or Object Message. But Message property is
null.

*http://tomee.apache.org/tomee-and-webspheremq.html
*

@Resource(name = "qcf") 
    private ConnectionFactory connectionFactory; 
    @Resource(name = "queue") 
    private Queue queue;
    Connection connection = connectionFactory.createConnection();
    Session session = connection.createSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer(queue);
    TextMessage message = session.createTextMessage();
    message.setText("Test Message");
*    message.setObjectProperty("a","b");
   message.setStringProperty("c","D");
*    connection.start();
    producer.send(message);
    session.close();
    connection.close();

Guide me why message property is null in MDB consumer.
   





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: IBM MQ Message property is null in MDB

Posted by Jonathan Gallimore <jo...@gmail.com>.
Oh wonderful, thank you for following up with that information. Apologies
for not knowing that, I'm very new to WMQ myself.

Jon

On Mon, Jul 31, 2017 at 5:44 AM, gnanapandithan <m....@gmail.com>
wrote:

> I found the root cause of the problem. it is my mistake. TopicProxy's
> targetClient should be JMS. I wrongly configured as MQ. so I was able to
> get
> message but not property.
>
> After configuring JMS. I am able to get message and property.
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-
> tp4682317p4682342.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: IBM MQ Message property is null in MDB

Posted by gnanapandithan <m....@gmail.com>.
I found the root cause of the problem. it is my mistake. TopicProxy's
targetClient should be JMS. I wrongly configured as MQ. so I was able to get
message but not property.

After configuring JMS. I am able to get message and property.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317p4682342.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: IBM MQ Message property is null in MDB

Posted by Jonathan Gallimore <jo...@gmail.com>.
That code was tested with TomEE 7.0.2 with WMQ 8. With the exception of the
WMQ jars which I can't distribute, you should have all of my code and
config.

My config (note tomee.xml and system.properties) is in the
src/main/tomee/conf directory. I just copy those into TomEE's conf
directory, and add the jars from the WMQ rar in the lib directory.

Jon


On 28 Jul 2017 5:56 pm, "gnanapandithan" <m....@gmail.com> wrote:

Please try with Tomee-plus 7.0.2 with IBM MQ 8. if works please share your
POC with me. thanks in advance



--
View this message in context: http://tomee-openejb.979440.
n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317p4682336.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: IBM MQ Message property is null in MDB

Posted by gnanapandithan <m....@gmail.com>.
Please try with Tomee-plus 7.0.2 with IBM MQ 8. if works please share your
POC with me. thanks in advance



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317p4682336.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: IBM MQ Message property is null in MDB

Posted by Jonathan Gallimore <jo...@gmail.com>.
I'm afraid this did also work for me in WMQ 8 and TomEE 7.0.2, using the
8.0.0.7 rar jars. I've included my test app and config here:
https://github.com/jgallimore/jms-test. Happy to tweak the config if it
isn't representative of your setup and try again.

I hope my test app and config is at least some help.

Jon

On Thu, Jul 27, 2017 at 5:00 PM, Jonathan Gallimore <
jonathan.gallimore@gmail.com> wrote:

> Hi
>
> This does work for me in WMQ 7.5, using the latest code in the TomEE 1.7.x
> branch. Will give it a go with TomEE 7 and WMQ 8. If that works, I'll
> provide my test app and config as a reference.
>
> Regards
>
> Jon
>
> On Wed, Jul 26, 2017 at 2:47 PM, gnanapandithan <
> m.gnanapandithan@gmail.com> wrote:
>
>> Hi jgallimore,
>>
>> Thanks for your reply. I suspect this issue due to Java EE connector api
>> and
>> resource adapter concept.
>>
>> IBM implement this by below class.
>>
>> com.ibm.mq.connector.ResourceAdapterImpl
>>
>> com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl
>>
>> I am using IBM JAR version : 8.0.0.5
>>
>>  Normal Java JMS api works fine. able to get Message property. Please try
>> with  Java EE connector api and resource adapter concept and let me know
>> if
>> it is working for you.
>>
>>
>>
>> --
>> View this message in context: http://tomee-openejb.979440.n4
>> .nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317p4682325.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.
>>
>
>

Re: IBM MQ Message property is null in MDB

Posted by Jonathan Gallimore <jo...@gmail.com>.
Hi

This does work for me in WMQ 7.5, using the latest code in the TomEE 1.7.x
branch. Will give it a go with TomEE 7 and WMQ 8. If that works, I'll
provide my test app and config as a reference.

Regards

Jon

On Wed, Jul 26, 2017 at 2:47 PM, gnanapandithan <m....@gmail.com>
wrote:

> Hi jgallimore,
>
> Thanks for your reply. I suspect this issue due to Java EE connector api
> and
> resource adapter concept.
>
> IBM implement this by below class.
>
> com.ibm.mq.connector.ResourceAdapterImpl
>
> com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl
>
> I am using IBM JAR version : 8.0.0.5
>
>  Normal Java JMS api works fine. able to get Message property. Please try
> with  Java EE connector api and resource adapter concept and let me know if
> it is working for you.
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-
> tp4682317p4682325.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: IBM MQ Message property is null in MDB

Posted by gnanapandithan <m....@gmail.com>.
Hi jgallimore,

Thanks for your reply. I suspect this issue due to Java EE connector api and
resource adapter concept. 

IBM implement this by below class. 

com.ibm.mq.connector.ResourceAdapterImpl

com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl

I am using IBM JAR version : 8.0.0.5

 Normal Java JMS api works fine. able to get Message property. Please try
with  Java EE connector api and resource adapter concept and let me know if
it is working for you.



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317p4682325.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: IBM MQ Message property is null in MDB

Posted by Jonathan Gallimore <jo...@gmail.com>.
Hi

Thanks for your email!

I'll debug my WMQ setup this evening for you and see if I can see anything
on the TomEE side that might be preventing this from working as you'd
expect.

Jon

On Wed, Jul 26, 2017 at 2:52 AM, gnanapandithan <m....@gmail.com>
wrote:

> I am publishing JMS text message to topic and consumer is able to consumer
> (
> MDB ) the text message. But  not able to get *Message Object and String
> property*. it is null in MDB consumer side. I have defined MDB in
> ejb-jar.xml under META-INF folder. I am using
>
> TomEE plus 7.0.2
> JMS 2.0
> IBM MQ 8
> JDK 1.8
> Topic
>
> I refereed below mentioned Tomee official example. In example they used
> tomee.xml instead i used resource.xml and don't use web.xml
>
> Consumer is MessageDrivenBean
>
> Consumer is able to get Text or Object Message. But Message property is
> null.
>
> *http://tomee.apache.org/tomee-and-webspheremq.html
> *
>
> @Resource(name = "qcf")
>     private ConnectionFactory connectionFactory;
>     @Resource(name = "queue")
>     private Queue queue;
>     Connection connection = connectionFactory.createConnection();
>     Session session = connection.createSession(false,
> QueueSession.AUTO_ACKNOWLEDGE);
>     MessageProducer producer = session.createProducer(queue);
>     TextMessage message = session.createTextMessage();
>     message.setText("Test Message");
> *    message.setObjectProperty("a","b");
>    message.setStringProperty("c","D");
> *    connection.start();
>     producer.send(message);
>     session.close();
>     connection.close();
>
> Guide me why message property is null in MDB consumer.
>
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.
> n4.nabble.com/IBM-MQ-Message-property-is-null-in-MDB-tp4682317.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>