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 » WebSphere Message Broker (ACE) Support » bad practise or not?

Post new topic  Reply to topic Goto page 1, 2  Next
 bad practise or not? « View previous topic :: View next topic » 
Author Message
atommail
PostPosted: Tue Nov 17, 2009 4:53 am    Post subject: bad practise or not? Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

Hello

I have to design request-reply scenario in websphere message broker toolkit.
I read that set CorrelId is bad practise, but could anybody tell my why?
or could anybody tell alternative from my scenario?

SystemY response in asynchronic way.

Flow in systemY_adapter_request:
MQInput-->ComputeNode-->HTTPRequest-->ComputeNode(storeState: set CorrelId using myId, store MqReply)-->MQOutput(storeState)

Flow in systemY_adpater_response
HTTPInput-->ComputeNode (setCorrelId using myId from HTTPInput)-->MQGet(getParameters by CorrelId ex. replyToQueue)-CopmuteNode -->MQReply

systemX_adapter flow put in systemY_adapter_request and get response from systemY_adpater_response flow --> this is synchronic scenario

I've already developed this and it is working, but I don't know, can I use this at production, Is it a bad practise or not? I don't have experience, because it is my first project please help me
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Nov 17, 2009 5:11 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

In general terms it is a normal design for a MQ request message to be processed by a server application which copies the msgid of the request message to the correlid of the response message.

The requestor then gets the response to their own request matching by correlid on the reply queue, and only two queues need to be defined (requests and responses) along with remote versions as needed.

One point is that response messages should have an expiry value set so that if they are not picked up then they expire. The design should allow many requestors to use the same set of queues at the same time.
Back to top
View user's profile Send private message
atommail
PostPosted: Tue Nov 17, 2009 5:47 am    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

zpat,

Ok, but this is common scenario using msgId and correlId,
How can I aply this to my scenario, I think I can't ?
Idon't have queue nodes but HTTP Request and asynchronic response from system Y to response flow. Response from System Y: system Y call webservice in systemY_adapter, system Y doesn't put response to queue, it call webservice, so I don't have msqId.
Back to top
View user's profile Send private message
atommail
PostPosted: Tue Nov 17, 2009 5:58 am    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

I have orderId and I use orderId instead of msqId
SET OutputRoot.MQMD.CorrelId = orderId;

Is it correct?
I don't have another idea.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Nov 17, 2009 7:57 am    Post subject: Reply with quote

Grand High Poobah

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

atommail wrote:
I don't have msqId.


You have the original msgid from the original request via MQInput.

To clarify your original question:

atommail wrote:
I read that set CorrelId is bad practise


setting correlId is not a bad practice. What is bad practice is using non-system ids (i.e. not msgId or correlId) because you can easily hit problems, mostly around non-uniquness. In your example, consider what would happen if the same order was changed or processed at the same time (given that you're using order id). Clearly you can design business or other processes to get round that but then you're reliant on 2 things working correctly...

Fewest moving parts, best practice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
atommail
PostPosted: Tue Nov 17, 2009 9:53 am    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

thanks for reply,

Quote:
You have the original msgid from the original request via MQInput.


Yes, I have, but I have HTTPRequest Node in response flow and I don't have msqId here, so still I have to take my scenario.

My orderId is unique,
consist of: customerId and CURRENT_TIMESTAMP AS CHARACTER FORMAT 'yyyyMMdd.HHmmss
Next I convert it to BLOB, so I think there is no way that i will have two messages in my storage_state_queue with the same CorrelId?

My question is: will be something wrong if somwhere in another flow, another queue be message with the same CorrelId (QueueManager set exactly the same what I set in my flow)?
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Nov 17, 2009 9:59 am    Post subject: Reply with quote

Grand High Poobah

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

atommail wrote:
Yes, I have, but I have HTTPRequest Node in response flow and I don't have msqId here


Doesn't mean you couldn't use it.

atommail wrote:
My orderId is unique,
consist of: customerId and CURRENT_TIMESTAMP AS CHARACTER FORMAT 'yyyyMMdd.HHmmss
Next I convert it to BLOB, so I think there is no way that i will have two messages in my storage_state_queue with the same CorrelId?


And relies on one order per customer per second.

atommail wrote:
My question is: will be something wrong if somwhere in another flow, another queue be message with the same CorrelId (QueueManager set exactly the same what I set in my flow)?


Yes.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
atommail
PostPosted: Tue Nov 17, 2009 10:54 am    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

thanks a lot for your respond

So, I have to change ma scenario, Could you help me?

Vitor wrote:
atommail wrote:
Yes, I have, but I have HTTPRequest Node in response flow and I don't have msqId here


Doesn't mean you couldn't use it.
l


I did mistake, I should write: "Yes, I have, but I have HTTPInput"

Could you tell me how I could use msgId?
How can I correlate request and replay I can't imagine this because this is two flows and when Response flow get Response call Response flow doesn't know anything about Request flow
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Nov 17, 2009 11:22 am    Post subject: Reply with quote

Grand High Poobah

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

atommail wrote:
Could you tell me how I could use msgId?


The same way you're using your orderid - the only point I'm making here is that it's a "better" id than the one you're generating.

atommail wrote:
How can I correlate request and replay


In your first post you said you had this working - stick to that.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
atommail
PostPosted: Tue Nov 17, 2009 11:39 pm    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

I am a bit confused now ...
So, I have to make better id , and then will be ok?
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Nov 18, 2009 12:42 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

Quote:
I am a bit confused now ...
So, I have to make better id , and then will be ok?


what's your confusion... spell it out..


you need not make a better id.. just use the other id.. which is considered better.. msg id

and correlation mechanism is same as you are using...
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
atommail
PostPosted: Wed Nov 18, 2009 1:15 am    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

My response flow:
HTTPInput -->ComputeNode (I set CorrelId here)-->MQGet -->other things

In Compute node I don't have msgId to use it, so I use my orderId

Everybody tell me that I should use msgId and I shouldn't use my orderId to set CorrelId, I know that, I should, but I can't, I don't have msgId.

One way, I see is make my orderId better, mean uniqness,
my idea myabe add seconds when I build it?
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Nov 18, 2009 1:29 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

ohhh.. ok ok

so you mean to say that you create a new unique id in request flow and send it as msg id in request

now in response flow u again use the same algo and create the unique id to get the exact response .. (which ll have the msg id sent as correl id)
and here both the flows are completely independent and not real req res...

the problem we all foreseeing here is the uniqueness of msg id..

is there no possibility of using database for storing the same... or may be in the message body as a field or as a comment in xml or somewhere something...
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
atommail
PostPosted: Wed Nov 18, 2009 1:47 am    Post subject: Reply with quote

Novice

Joined: 03 Nov 2009
Posts: 11
Location: Poland

AkankshA wrote:

so you mean to say that you create a new unique id in request flow and send it as msg id in request

No I don't sent msgId in Request flow I have HTTP Request Node I build my order Id and I send my Request
Next In Response in another flow I get my orderId


AkankshA wrote:

and here both the flows are completely independent and not real req res...

exactly
AkankshA wrote:

is there no possibility of using database for storing the same... or may be in the message body as a field or as a comment in xml or somewhere something...

I don't think so.

So, My idea when I bulid orderIs - use time mor precisely (milisecond) ex CURRENT_TIMESTAMP AS CHARACTER FORMAT 'yyyyMMdd.HHmmssms is bad?
Back to top
View user's profile Send private message
AkankshA
PostPosted: Wed Nov 18, 2009 2:43 am    Post subject: Reply with quote

Grand Master

Joined: 12 Jan 2006
Posts: 1494
Location: Singapore

atommail wrote:


So, My idea when I bulid orderIs - use time mor precisely (milisecond) ex CURRENT_TIMESTAMP AS CHARACTER FORMAT 'yyyyMMdd.HHmmssms is bad?


excuse my ignorance if you think the thread has been dragged too long

well my point is
we are populating the variable orderid with timestamp for its uniqueness

So rather then building the orderid from current_timestamp, why not use the msgId of MQMD as thats reliable enough for uniqueness

i.e. set order id = MQMD.MsgId
_________________
Cheers
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » bad practise or not?
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.