|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Message Model question |
« View previous topic :: View next topic » |
Author |
Message
|
twegmann |
Posted: Wed Jul 02, 2003 6:03 am Post subject: Message Model question |
|
|
 Novice
Joined: 09 Aug 2001 Posts: 23 Location: New Jersey
|
Here is a general sort of question regarding best practices on modeling/designing a message format.
Some background: We need to integrate some promotion data between applications. The promotion data consists of a promo code and some attributes like name, start date, end date, etc. As well, there are account codes & product line codes that are part of the promo definition (and each of these has some associated attributes like budget & allocation percents). The number of accounts and prod lines varies for each promo. Each promo has a minimum of 1 account & one product line, but could have multiple accounts and multiple product lines. Most of the existing promos only have a few accounts & a few product lines, but there are some oddball existing promos that have 10 accounts & 70 product lines. The business folks tell us that theoretically, they could define a promo with any number of accounts & any number of product lines, though they can't imagine every really exceeding 50 accounts & 150 product lines.
Also, xml is not an option for this particular message. XML would handle the repeating account & product line info quite nicely, but alas, can't use it here.
So, my question is, should I create one big fixed message format allowing for all the potential repeating account & product line codes (many of which would be blank for a given promo), or, should I create a series of header detail messages (the header containing the promo code & attributes, each detail message containing either an account or product line) ?
I have read some theory that says each message should be a full and complete transaction (which in this case would transport a lot of blank bytes needlessly) versus splitting the transaction across mulitple messages and then having to have a way to recognize when all the pieces have arrived to avoid processing only half the transaction.
Are there any guidelines or best practices anyone can recommend on this ? Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jul 02, 2003 6:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think you should create header/detail messages. Unless there are additional requirements that you haven't mentioned that would require passing empty placeholder data. You might consider using a tagged and or delimited structure to model repeating elements and optional elements - as it is usually much easier for a variety of products to parse data described that way.
The point about each message being a full transaction isn't saying that your message should include empty data to represent every possible combination of data. It's saying that each message should contain a complete logical unit of work.
If your logical unit of work is a single promotion (containing multiple accounts and products), then each message should describe a single promotion. If your logical unit of work is a group of promotions, then each message should describe a group of promotions. If your logical unit of work is a single account or product, then that's what your message describes. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Jul 02, 2003 6:31 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Quote: |
have read some theory that says each message should be a full and complete transaction (which in this case would transport a lot of blank bytes needlessly)
|
Exactly how much empty data? Sometimes you get pennywise but pound foolish. If you are only gonna be sending 4K of data, whether it is full or empty, who cares? Save yourself the grief of having to code for multiple message and just put them all into one.
If the possability exists for the empty messages to be huge, then maybe it is worthwhile.
While I am all for making things as effecient as possible, memory, storage and bandwidth are all pretty cheap nowadays compared to what they used to be. Don't spend days and weeks coding just to save a few cents. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
twegmann |
Posted: Thu Jul 03, 2003 5:26 am Post subject: |
|
|
 Novice
Joined: 09 Aug 2001 Posts: 23 Location: New Jersey
|
Jeff - thanks for the feedback.
The transaction here (the logical unit of work) is a single promotion, which includes all it's account & product lines.
If I use the header/detail design, I would be splitting the logical unit of work across messages. Hence I would risk potentially processing only half the transaction (the header and some of the detail msgs) if, for some reason, all the detail msgs didn't make it to the target queue. I could compensate for this in the target adapter by including logic to verify that in fact all the msgs are present for the full logical unit of work before committing the transaction.
So, it's a tradeoff between message format/size versus adapter complexity.
So I guess what I am trying ask is : is it generally a good rule of thumb to keep each message as a full logical unit of work and thus avoid extra complexity in the adapter, or, is it generally a good rule of thumb to optimize message format/size even if it adds some additional complexity to the adapter? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jul 03, 2003 6:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Quote: |
If I use the header/detail design, I would be splitting the logical unit of work across messages. |
.
I guess I don't understand that. Why would you need to put each account in a different message?
I'm thinking of a model something like this - PromotionHeader
- Account1Detail
- Product1Detail
- ...
- ProductNDetail
- ...
- AccountNDetail
- Product1Detail
- ...
- ProductNDetail
So the promotion includes a variable number of accounts and each account includes a variable number of products. Each record is identified as the correct type by a tag - so there's a tag that tells you the record you're reading is an account record, and a tag that tells that you're reading a product record. Then you can tell when the products for one account end and the next account starts - because you've seen another account tag.
But Peter Potkay is correct that you shouldn't worry about sending empty data if your total data size is small. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|