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 » can I mix "com.ibm.mq.*" and "javax.jms.*&quo

Post new topic  Reply to topic
 can I mix "com.ibm.mq.*" and "javax.jms.*&quo « View previous topic :: View next topic » 
Author Message
sebastia
PostPosted: Wed Nov 17, 2004 4:39 am    Post subject: can I mix "com.ibm.mq.*" and "javax.jms.*&quo Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

.
We have some code implemented using "com.ibm.mq.*",
this is "WebSphere MQ base Java",
and somo other code that uses "javax.jms.*",
this is "WebSphere MQ JMS".
.
We need to mix all that code,
but we are having very "strange" situations, as MsgID having 24 bytes length sometimes, or 48 bytes few lines later ...
.
CAN WE DO THIS KIND OF MIXTURE ???
.
I mean, using BOTH classes in the same code,
as sending a message using ...
... MQQueue qData = qMgr.accessQueue ...
... qData.put ( mymsg, pmo ) ;
... qData.close () ;
and later receive the answer using ...
... srvQ.connectToQueue ( "Sample/JMS/REPLYIMS" ) ;
... byte[] bMsg = srvQ.receiveMessage ( 120000, msgID ) ;
.
Thanks. Sebastian.
.
P.D.- we need "base Java" in order to be able to write the "UserIdentifier" field, as we are sending to a S/390, and this is NOT POSSIBLE using "JMS".
Also, we need "JMS", as all the "old" code was written using thas class ...
.
Back to top
View user's profile Send private message Visit poster's website
RogerLacroix
PostPosted: Wed Nov 17, 2004 9:23 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

About the mixing of LIBs, I have no idea, but MsgID and CorrelID are 24 byte fields. The 48 characters you are referring too, is the 24 byte field in a HEX format X'202020 ...'.

You can set the UserID of a connection (hence message) using:
Code:
queueConnectionFactory.createQueueConnection("myUserId", null);


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Wed Nov 17, 2004 2:24 pm    Post subject: Reply with quote

Grand High Poobah

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

Roger,

If my memory serves me well (can't seem to find where in using java the difference between bindings and client is described)...
Roger Lacroix wrote:
You can set the UserID of a connection (hence message) using:
Code:
 queueConnectionFactory.createQueueConnection("myUserId", null);


This works very well if you are in client connection. If you use 2 phase commit and bindings I believe you "have" to use the same user as the os user running the WAS. Otherwise authentication fails...

F.J.
Back to top
View user's profile Send private message Send e-mail
sebastia
PostPosted: Thu Nov 18, 2004 2:36 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Thanks, Roger (and F.J.) ...
Yes, I guess it was a reading misunderstanding ...

But, when I receive the MessgeID from the UPES,
msgIdUpes = msg.getJMSMessageID();
System.out.println("JmsMI bean [" + msgIdUpes + "("+ msgIdUpes.length() +")]." );
it is a 48-byte string :
JmsMI bean [ID:414d5120464d43514d2020202020202000029b4120005976(51)].
.
The remote application will move it to CorrelID, as usual.
So, we want to use this string at Receive time, when we have to provide a 24-byte string.
.
WHAT FUNCTION SHALL WE USE TO TRANSLATE THE 48-byte HEX String
(x34, x31, x34, x44, x35, x31, x32, x30 ...)
into a 24-byte ASCII String ????
(x41, x4D, x51, x20, x46 ...)
.
Sebastian.
.
P.D.- another related question : shall we remove the leading "ID:" string ?
With those chars included, the MessageID has 51 bytes ...
.
P.D.2 - we tested the function you mention, and it did NOT work ...
createQueueConnection("myUserId", null);
.
Sorry I dont remember the details why it did not work, but WE HAVE to use "com.ibm.mq.*" to set the UserIdentified field in the MD ...
.
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Thu Nov 18, 2004 4:23 pm    Post subject: Reply with quote

Grand High Poobah

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

Sebastia wrote:
WHAT FUNCTION SHALL WE USE TO TRANSLATE THE 48-byte HEX String
(x34, x31, x34, x44, x35, x31, x32, x30 ...)
into a 24-byte ASCII String ????
(x41, x4D, x51, x20, x46 ...)
.
Sebastian.
.
P.D.- another related question : shall we remove the leading "ID:" string ?
With those chars included, the MessageID has 51 bytes ...


Please note: a) the 48 byte string is a hex representation of a 24 byte array.
DO NOT ASSUME THAT YOU CAN USE A STRING. The system treats it like a byte array. JMS wraps it (the byte array) to and from a hex string representation.

b) the marker "ID:" in front of the string qualifies it as a provider message/correlation ID. Read the Using Java manual and the J2EE spec. on JMS for the Message interface.

Quote:
P.D.2 - we tested the function you mention, and it did NOT work ...
createQueueConnection("myUserId", null);

Don't know if you can pass null. An empty String "" might do the trick though.

Enjoy
Back to top
View user's profile Send private message Send e-mail
vennela
PostPosted: Fri Nov 19, 2004 9:19 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

I saw some references to UPES so I assume that you are trying to reply to workflow.
AFAIK, workflow doesn't care about MsgIds and CorrelIds. If you give the ActImplCorrelID in the XML message, then that should be enough.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Mon Nov 22, 2004 7:50 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

For what it is worth, there is a new sample - CorrelExample.java - out at:

http://www.developer.ibm.com/tech/sampmq.html

It does some selective message retrieval via JMS using correlation id.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » can I mix "com.ibm.mq.*" and "javax.jms.*&quo
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.