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 » How to set MQRFH2 header in a message using JMS

Post new topic  Reply to topic
 How to set MQRFH2 header in a message using JMS « View previous topic :: View next topic » 
Author Message
ambika pathak
PostPosted: Fri Sep 23, 2011 3:00 am    Post subject: How to set MQRFH2 header in a message using JMS Reply with quote

Newbie

Joined: 23 Sep 2011
Posts: 5

Hi,

Could somebody tell how to add/modify/set MQRFH2 header using JMS APIs, not using MQ Nodes or MQ APIs please.

I want to add a custom MQRFH2 header.
I'm using a standalone program to access MQ bound JMS queue which is hosted with v6.0 of MQ. Message needs to go to MQ queue through JMS queue.

Any link on this would also help.

Thanks,
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Sep 23, 2011 4:05 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

JMS will populate any message properties you set into the MQRFH2. It will, however, put them in a very specific portion of the MQRFH2 and in a very specific format. This may not match what you want.

JMS does not otherwise, in general, allow you to manipulate provider-specific message content. This is ON PURPOSE AND BY DESIGN.

So you may have no mechanism for doing what you want to do. If that is the case, what is your next plan to meet your actual business requirement?

Also, upgrade to MQ v7. Today. Do not write new code for MQ v6.
Back to top
View user's profile Send private message
ambika pathak
PostPosted: Fri Sep 23, 2011 6:10 am    Post subject: Reply with quote

Newbie

Joined: 23 Sep 2011
Posts: 5

Appreciate your responce.

As you rightly said I'm looking out to meet a business requirement wherein clients have some strange setup of Topics at their end connected to queues (Not sure how). So they want us to populate a normal MQ queue through JMS with some specific values in MQRFH2 header in jms/dst folder with topic://topic_name etc.

Now the problem is we can not update this folder doing some string operation through JMS APIs as it requires a valid Destination object (Queue, Topic etc.) for it to be set as JMSDestination so that it appears under jms/dst in the receiving queue.

I just created a valid Topic object by looking up from context and set it like this,

TextMessage oMessage = oSession.createTextMessage();
Topic oTopic = (Topic) oContext.lookup("TOPIC1");
oMessage.setJMSDestination(oTopic);

Queue oQueue = (Queue) oContext.lookup(oContext, "Q1"); //Q1 JMS queue name which is is bound to MQ queue QL1 under manager QLM1

QueueSender oSender = oSession.createSender(oQueue);
oSender.send(oMessage)

When I'm sending this then it is not recongnizing the topic and instead putting the details of the mq queue (in this case QL1 under manager QLM1) in jms/dst folder as <jms><Dst>queue://QLM1/QL1</Dst></jms>

However I wished to see , <jms><Dst>topic://TOPIC1</Dst></jms>
or something like this.

Update to MQ7 depends purely on business stategy of clients.

Please let me know in case I'm getting something wrong here.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Sep 23, 2011 6:56 am    Post subject: Reply with quote

Grand High Poobah

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

you're getting everything wrong.
If you want to see a topic in your destination you will need to put the message using JMS Publish to a Topic destination. I hope your queue is subscribed to said topic....

Learn JMS: The sun tutorial is quite good
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ambika pathak
PostPosted: Fri Sep 23, 2011 7:15 am    Post subject: Reply with quote

Newbie

Joined: 23 Sep 2011
Posts: 5

@fjb_saper,

I guess you did not pay attention to the prestext before the code which I pasted. I'm running under some constraints posed by clients they want an MQPut on a normal queue and not publish.

I understand I'll be able to do it by publishing. There is no doubt about this.I just wanted to know if there is any possibility of setting destination with topic name without publishing with a point-to-point communication, meaning if it is technically feasible in someway.

I wrote the program to cross check this point. Just wanted to understand if the gurus also think that it would not work or if it is feasible they suggest something to me.

If this is by any mean not feasible then I'll have to go back to client and tell them this constraint. Just that I want to be 100% sure before I suggest them this.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Sep 23, 2011 7:50 am    Post subject: Reply with quote

Grand High Poobah

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

ambika pathak wrote:
I'm running under some constraints posed by clients they want an MQPut on a normal queue and not publish.


So you either need to explain to the clients (who are paying you for your advice) that you can't publish by just putting on a queue, or find out why this contrainst exists. It could easily be as simple as they think the pub/sub component is separately chargable and they're trying to be cheap.

ambika pathak wrote:
if the gurus also think that it would not work or if it is feasible they suggest something to me.


It won't.

ambika pathak wrote:
I'll have to go back to client and tell them this constraint.


As I said above, it's perhaps more interesting why the client has come up with this surprisingly detailed and technical constraint. Many clients of my experience can't spell "MQput", never mind know what it does.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ambika pathak
PostPosted: Fri Sep 23, 2011 8:57 am    Post subject: Reply with quote

Newbie

Joined: 23 Sep 2011
Posts: 5

@Vitor

Appreiate your response. Actually client has got a technical team which came up with this idea.

No problem I'll confirm that we can only publish to topics as otherwise it is not possible to update jms/dst with topic string by any mean.

Appreciate all the help.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Sep 23, 2011 9:40 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

ambika pathak wrote:
@Vitor

Appreiate your response. Actually client has got a technical team which came up with this idea.

No problem I'll confirm that we can only publish to topics as otherwise it is not possible to update jms/dst with topic string by any mean.

Appreciate all the help.


It's possible to update the JMS/dst with a topic string. Just not by using pure JMS code.
Back to top
View user's profile Send private message
ambika pathak
PostPosted: Fri Sep 23, 2011 10:13 am    Post subject: Reply with quote

Newbie

Joined: 23 Sep 2011
Posts: 5

@mqjeff

Do you mean that it's possible without publishing too?
May be by not using JMS APIs but by using MQ objects or something else I can achieve this and when I send the message to queue using mqput the jms/dst will be updated like this <jms><Dst>topic://TOPIC1</Dst></jms> irrespective of this not being published.


Request you to elaborate how this can be done, just for information.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Sep 23, 2011 11:13 am    Post subject: Reply with quote

Grand High Poobah

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

ambika pathak wrote:
@mqjeff

Do you mean that it's possible without publishing too?
May be by not using JMS APIs but by using MQ objects or something else I can achieve this and when I send the message to queue using mqput the jms/dst will be updated like this <jms><Dst>topic://TOPIC1</Dst></jms> irrespective of this not being published.


Request you to elaborate how this can be done, just for information.


Have you checked what the message would look like if instead of publishing to the average stream queue you had aliased it to send the message where you want? (still pure JMS). Unorthodox and cross purpose to general JMS doctrine... Still even easier if you do pub/sub and create a specific queue to receive your publications and use it at subscription time...

As mqjeff said, there are ways to handle such a requirement. The ones you are looking at do not make much sense.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to set MQRFH2 header in a message using JMS
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.