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 » Generating sequence numbers using ESQL

Post new topic  Reply to topic
 Generating sequence numbers using ESQL « View previous topic :: View next topic » 
Author Message
swaugh
PostPosted: Wed Mar 12, 2008 8:49 am    Post subject: Generating sequence numbers using ESQL Reply with quote

Apprentice

Joined: 15 Jun 2006
Posts: 37

hi,
is there any way in esql, we can generate a sequence number that we can maintain and generate regularily.

do we need to use shared variables?


thanks,
swaugh
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 12, 2008 8:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You only need to use a shared variable if you need to have the sequence stay unique across invocations of a node or a flow.

If you only need the sequence number to be unique within a node or a flow, then you don't need a shared variable.

You won't likely be able to use ESQL to generate a sequence number that is unique across a broker or between a broker - unless you use the UUID functions...

EDIT: "between brokers", not "between a broker".

And technically, the UUID functions don't produce results that are sequential. But they are unique!
_________________
I am *not* the model of the modern major general.


Last edited by jefflowrey on Wed Mar 12, 2008 9:37 am; edited 1 time in total
Back to top
View user's profile Send private message
swaugh
PostPosted: Wed Mar 12, 2008 9:20 am    Post subject: Reply with quote

Apprentice

Joined: 15 Jun 2006
Posts: 37

Thanks Jeff.
Back to top
View user's profile Send private message
francoisvdm
PostPosted: Wed Mar 12, 2008 11:01 am    Post subject: Reply with quote

Partisan

Joined: 09 Aug 2001
Posts: 332

If it is not a super high performance flow, just pop the sequence number in a queue, read it from there for next flow, add 1, pop back
_________________
If you do not know the answer or you get the urge to answer with "RTFM" or "Search better in this forum", please refrain from doing so, just move on to the next question. Much appreciated.

Francois van der Merwe
Back to top
View user's profile Send private message Send e-mail
chrisc
PostPosted: Wed Mar 12, 2008 2:00 pm    Post subject: Reply with quote

Voyager

Joined: 19 Mar 2006
Posts: 77

Francois' suggestion is an interesting one, although it may be difficult (impossible?) to wrap such a thing in a simple procedure in ESQL that could be called from your flow(s). It also has a big disadvantage in that multi-threading your flows wouldn't work, because the counter message wouldn't appear back on the queue until the other thread had committed its transaction.

One technique we have used in the past is just use a database sequence, and use ESQL to retrive the sequence. This has the advantage of working across multiple flows and being both unique and sequential.

If the database doesn't support sequences there are ways of doing the same thing with triggers or stored procedures as well. Just don't do non-atomic SELECT then UPDATE statements to read a value in a table and then update it to +1 or you could get inconsistent results.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Generating sequence numbers using ESQL
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.