Author |
Message
|
bamboozled_by_MQ |
Posted: Fri Oct 08, 2004 6:05 am Post subject: difficult design issue |
|
|
Voyager
Joined: 07 Jan 2004 Posts: 75
|
The message is coming from a legacy AS400(ebcidic)
This message contains a transaction code like, UP55 and data
(UP55 meaning it is an account update transacation).
the message is being sent to a windows server(ascii) that has WAS 5 and Websphere MQ 5.3 server.
the message is being sent over and dropped in an MQ Queue that a message driven bean
is listening to. the message must now be given to a business component(POJO) after it is converted
into a byte[]?
that is the end of messaging so..
the question is design-wise how would I be able to process this message( BUT be able to
attach some "flag" saying UP55) so all the other business programs know that it is a UP55 so it they can
send it along with the data to the next business component successfully
so basically it could go from component to component and have a field that can be
read by each component along with the data..
any ideas?
let me ask this..
should I just take this mq Message on the MQ queue and create a in house object with fields so each POJO could look inside (OBJ.transaction = UP55) and it have the actual data in a byte[]?
am I making sense?
thanks all!! |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 08, 2004 7:09 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Use an MQ Rules and Formatting Header. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bamboozled_by_MQ |
Posted: Fri Oct 08, 2004 7:16 am Post subject: |
|
|
Voyager
Joined: 07 Jan 2004 Posts: 75
|
so the MDB should pickup the message from the native MQ Queue and add an MQRFH2 header and insert the trancode I want(UP55) but then how would the POJO business object be able to look and see the UP55 ? |
|
Back to top |
|
 |
JLRowe |
Posted: Fri Oct 08, 2004 7:59 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
Get your MDB to parse the message and populate an object, pass the object around to all your other components.
Passing around a byte[], means every component needs to parse the message, put all your parsing code in one place - the MDB. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 08, 2004 1:39 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I would even go as far as setting up a helper class to do all the formatting and parsing for the objects.
Enjoy |
|
Back to top |
|
 |
bamboozled_by_MQ |
Posted: Fri Oct 08, 2004 2:00 pm Post subject: |
|
|
Voyager
Joined: 07 Jan 2004 Posts: 75
|
So I can have the MDB call and instance of the helper class and have it parse through the MQ message and create an "in house" object message.
Man I have learned so much lately for this is all so new.
create string field for replytoQ
create date filed for timedatestamp
create Byte[] for the actual data...
etc, etc...
is this correct?
does anyone have any examples or samples of a java pgm parsing a mq message and building a object. even the smallest example will help
thank you everyone. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 08, 2004 2:39 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You mentioned that your source is EBCDIC and the target possibly windows or unix. Make sure to transmit no numeric packed values. All values should be text and the format of the message being sent MQSTR.
This way MQ will automatically translate the message from EBCDIC.
You helper will then do the rest through parsing...
Enjoy  |
|
Back to top |
|
 |
bamboozled_by_MQ |
Posted: Sat Oct 09, 2004 5:55 am Post subject: |
|
|
Voyager
Joined: 07 Jan 2004 Posts: 75
|
your post was a little confusing saber.
youre right it is coming over from and as400 to a win box (MQ queue to MQ queue) but it is a MDB getting the message the off the MQ queue..
Are you simply saying use MQFMT_STR before it is sent on the as400?
do i need to use MQGMO_CONVERT (being an MDB is picking it up)
- in my last post I was asking about going through the message and creating a custom object resembling a jms message but that can passed to all the other components
Quote: |
So I can have the MDB call and instance of the helper class and have it parse through the MQ message and create an "in house" object message.
Man I have learned so much lately for this is all so new.
create string field for replytoQ
create date filed for timedatestamp
create Byte[] for the actual data...
etc, etc...
is this correct?
does anyone have any examples or samples of a java pgm parsing a mq message and building a object. even the smallest example will help
|
thanks for your help saber |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Oct 09, 2004 7:24 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think you are trying to over think this.
Maybe.
If your AS/400 programs add an MQRFH header to the message, then any program that reads the message later will be able to access the MQRFH.
If your MDB reads the message, and then repeatedly calls several other POJOs, then you should follow jlrowe's advice. The job of your MDB should be to read the message from a queue, construct an object from that message, and then all of the POJOs should implement an interface that takes that object as a parameter. Essentially, this is a Command pattern.
You can include the body of the message in the object as a Byte[] if you have to, but if you know that the format of the data will be the same across all POJOs, then your MDB should parse the body of the message into an object that encapsulates that data.
If your MDB is going to call a bunch of POJOs in sequence, and then put the message BACK onto a queue, and send that information to other processes "down stream" from the AS/400, then your MDB should reconstruct the message after the POJO calls, and rebuild the MQRFH to include any relevant metadata. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Oct 09, 2004 3:17 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
bamboozled_by_MQ wrote: |
1)Are you simply saying use MQFMT_STR before it is sent on the as400?
2)do i need to use MQGMO_CONVERT (being an MDB is picking it up)
|
1) Yes this way the translation is automatic. If you treat this as byte[] message and do not format to MQFMT_STR then your helper will need to translate text parts from EBCDIC to ASCII
2) Again you are confusing MQ base with JMS. In JMS you do not need to specify the option. JMS does it for you.
As well read carefully Jefflowrey's advice. As always a very sound piece of advice.
Enjoy  |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Oct 09, 2004 6:31 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
fjb_saper wrote: |
As well read carefully Jefflowrey's advice. As always a very sound piece of advice. |
While I appreciate the compliment... if I have anything useful to add, it's because I've learned from my mistakes (and, perhaps, the mistakes of others...) _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|