ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » JMS vs MQJMS

Post new topic  Reply to topic
 JMS vs MQJMS « View previous topic :: View next topic » 
Author Message
cherry
PostPosted: Sat Sep 21, 2013 5:36 am    Post subject: JMS vs MQJMS Reply with quote

Newbie

Joined: 21 Sep 2013
Posts: 4

Hi all,

I am a newbie in JMS. I want to send message to a mainframe MQ from JAVA application.

I wrote my code in J2EE-JMS API but later found an issue that i need to set TARGETCLIENT as MQ and not as JMS(set by default) to remove RFH2 header.

using JAVA-JMS API, i am not able to find any way to set this property.

My question is: do i need to use MQ-JMS(IBM API) to set this property or is there any other work around which can help?

Thanks
Cherry!
Back to top
View user's profile Send private message
jsware
PostPosted: Sat Sep 21, 2013 7:06 am    Post subject: Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

Hi Cherry,

I think the following page should help you send messages without RFH2 headers.

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/topic/com.ibm.mq.doc/jm25430_.htm

Kind Regards
John
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Sep 21, 2013 8:14 am    Post subject: Re: JMS vs MQJMS Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

cherry wrote:
Hi all,

I am a newbie in JMS. I want to send message to a mainframe MQ from JAVA application.

I wrote my code in J2EE-JMS API but later found an issue that i need to set TARGETCLIENT as MQ and not as JMS(set by default) to remove RFH2 header.

using JAVA-JMS API, i am not able to find any way to set this property.

My question is: do i need to use MQ-JMS(IBM API) to set this property or is there any other work around which can help?

Thanks
Cherry!


Hi Cherry,

Have you tried using the URI form of the destination?

Instead of using
Code:
session.createQueue("SOME.QUEUE");
// use
session.createQueue("queue:///SOME.QUEUE?targetClient=1");


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
cherry
PostPosted: Sat Sep 21, 2013 8:54 am    Post subject: Reply with quote

Newbie

Joined: 21 Sep 2013
Posts: 4

jsware wrote:
Hi Cherry,

I think the following page should help you send messages without RFH2 headers.

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/topic/com.ibm.mq.doc/jm25430_.htm

Kind Regards
John


jsware: I have gone through this documentation.
This is MQ specific JMS code which uses IBM libs.
My code is in JMS not MQJMS. so this is a second option if i do not use JMS.
Back to top
View user's profile Send private message
cherry
PostPosted: Sat Sep 21, 2013 8:59 am    Post subject: Re: JMS vs MQJMS Reply with quote

Newbie

Joined: 21 Sep 2013
Posts: 4

fjb_saper wrote:


Hi Cherry,

Have you tried using the URI form of the destination?

Instead of using
Code:
session.createQueue("SOME.QUEUE");
// use
session.createQueue("queue:///SOME.QUEUE?targetClient=1");


Have fun


I have not used URI form of the destination. I have used MessageProducer and MessageConsumer along with JNDI to lookup their destination.

Is it possible to do so with JNDI lookup?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Sep 21, 2013 5:05 pm    Post subject: Re: JMS vs MQJMS Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

cherry wrote:

I have not used URI form of the destination. I have used MessageProducer and MessageConsumer along with JNDI to lookup their destination.

Is it possible to do so with JNDI lookup?

I suspect you have been using the qmgr as a JNDI repository. IBM often offers this as an example. It does the job but has a limited scope and functionality..., when compared to the file based JNDI or true J2EE server JNDI... IMHO it should be banned. Use the File based JNDI provider that comes with the product (sun...RFS... etc...).
It will provide excellent training wheels for JNDI lookup.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jsware
PostPosted: Mon Sep 23, 2013 2:52 am    Post subject: Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

cherry wrote:

jsware: I have gone through this documentation.
This is MQ specific JMS code which uses IBM libs.
My code is in JMS not MQJMS. so this is a second option if i do not use JMS.


You can write your code to be JMS compliant, so you're not using any MQ extensions. Any MQ JMS specifics can be separated out into configuration settings.

When you create the JMS definitions in JNDI that you reference for the CF and Q definitions etc, you can specify the TARGCLIENT setting, which should make your code agnostic to MQ's JMS implementation

Lets take an example. Assuming you have MQ on Windows as a test bed:

1. Create c:\JNDI-Directory
2. CD c:\Program files\IBM\WebSphere MQ\java\bin (or WebSphere MQ_1) for > MQ 7.1
3. JMSAdmin
4. From the InitCtx > prompt
5. DEF Q(SDLQ) queue(SYSTEM.DEFAULT.LOCAL.QUEUE) TARGCLIENT(MQ)

Now when you use that JNDI definition of a JMS queue called "SDLQ", it will resolve to an MQ queue SYSTEM.DEFAULT.LOCAL.QUEUE and any messages written should not have an RFH2 header.

There will be no MQ JMS specifics in your program, which would work equally well using another JMS provider (you will have to use the JMSAdmin tool for that provider to configure a JMS q called SDLQ to resolve to an actual queue).
Caveat emptor - I am doing this all from memory.
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
cherry
PostPosted: Tue Sep 24, 2013 12:24 am    Post subject: Re: JMS vs MQJMS Reply with quote

Newbie

Joined: 21 Sep 2013
Posts: 4

fjb_saper wrote:
cherry wrote:

I have not used URI form of the destination. I have used MessageProducer and MessageConsumer along with JNDI to lookup their destination.

Is it possible to do so with JNDI lookup?

I suspect you have been using the qmgr as a JNDI repository. IBM often offers this as an example. It does the job but has a limited scope and functionality..., when compared to the file based JNDI or true J2EE server JNDI... IMHO it should be banned. Use the File based JNDI provider that comes with the product (sun...RFS... etc...).
It will provide excellent training wheels for JNDI lookup.

Have fun


I am using Websphere Application server 7, where my JMSConnection factory and queues are defined.

I have now used MQJMS in my code to set the TARGCLIENT property and getting the response properly.

The only problem that remains is how to lookup mqconnectionfactory object through JNDI?

In JMS API we can use JNDI to create a Connection factory.
but MQJMS API do not provide any method to do so.
I have to manually set all the factory properties like host, channel etc.

I am able to lookup queues defined throuth JNDI in destination object!
any suggestions?!!
Back to top
View user's profile Send private message
jsware
PostPosted: Tue Sep 24, 2013 6:05 am    Post subject: Re: JMS vs MQJMS Reply with quote

Chevalier

Joined: 17 May 2001
Posts: 455

cherry wrote:

I am using Websphere Application server 7, where my JMSConnection factory and queues are defined.

I have now used MQJMS in my code to set the TARGCLIENT property and getting the response properly.

You should be able to set the TARGCLIENT on the JMS queue definition in JNDI.
cherry wrote:

The only problem that remains is how to lookup mqconnectionfactory object through JNDI?

In JMS API we can use JNDI to create a Connection factory.
but MQJMS API do not provide any method to do so.
I have to manually set all the factory properties like host, channel etc.

I am able to lookup queues defined throuth JNDI in destination object!
any suggestions?!!
If you want to remain MQJMS agnostic and JMS pure, see http://docs.oracle.com/javaee/1.4/tutorial/doc/JMSJ2EEex2.html for details - I know it uses a publish message, but its easy to change it to use a queue instead. (Cast to a Queue instead of Topic object) and keep the TARGCLIENT setting defined in JNDI.
_________________
Regards
John
The pain of low quaility far outlasts the joy of low price.
Back to top
View user's profile Send private message
hughson
PostPosted: Fri Sep 27, 2013 4:51 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1959
Location: Bay of Plenty, New Zealand

You don't need to set TARGETCLIENT anymore you can just define the queue so that the getters don't receive the RFH2 header. Just add PROPCTL(NONE) to your queue definition on the queue manager.

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Fri Sep 27, 2013 6:56 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

hughson wrote:
You don't need to set TARGETCLIENT anymore you can just define the queue so that the getters don't receive the RFH2 header. Just add PROPCTL(NONE) to your queue definition on the queue manager.


Ooo....top tip!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » JMS vs MQJMS
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.