Author |
Message
|
puja0830 |
Posted: Tue May 31, 2011 7:56 am Post subject: Purge Queue - WMB |
|
|
Newbie
Joined: 31 May 2011 Posts: 9
|
Need help with below requirement. I appreciate your help.
Read the messages from a queue for every 10 min or certain amount of time.
Iterate through all the messages and route the message to different files based on field in the message(XML fromat).
Example:
Msg1:
<Dept>Sales</Dept>
<...>
<...>
Msg2:
<Dept>Finance</Dept>
<...>
<...>
Msg3:
<Dept>Sales</Dept>
<...>
<...>
When iterating through the messages, need to extract the dept Name(Sales) and create a file with the name Sales_Timestamp.txt. and when the next message from the same dept, the message should be appended in the same file. If the next message is from Finance, new file should be created with name Finance_Timestamp.txt and the message which has the same dept name should be appended to the same file.
Thanks. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue May 31, 2011 8:01 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Wow, this sounds like a really exciting project. Do you need some developers to work on it for you? Will you allow remote working? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 31, 2011 8:02 am Post subject: Re: Purge Queue - WMB |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
puja0830 wrote: |
Read the messages from a queue for every 10 min or certain amount of time. |
a) Why? Why not read the messages as they arrive?
b) What controls the period of time? How often does it change?
c) Why can't you use Timer nodes?
puja0830 wrote: |
Iterate through all the messages and route the message to different files based on field in the message(XML fromat). |
This is WMB 101. There are any number of ways to achieve this.
puja0830 wrote: |
When iterating through the messages, need to extract the dept Name(Sales) and create a file with the name Sales_Timestamp.txt. and when the next message from the same dept, the message should be appended in the same file. If the next message is from Finance, new file should be created with name Finance_Timestamp.txt and the message which has the same dept name should be appended to the same file. |
Why? What's the requirement? Is this just an audit of messages because no-one believes that WMQ really does provide assured delivery (again) or because management doesn't believe any system is complete without an audit log, even a pointless one (again)?
It would also be polite to mention what you've done so far and what problems you've encountered so we can provide more targetted advice, rather than generalist "this is how you use WMB". _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
puja0830 |
Posted: Tue May 31, 2011 9:08 am Post subject: |
|
|
Newbie
Joined: 31 May 2011 Posts: 9
|
Hi All,
It is the requirement given by my team lead for reporting the number of messages got from each dept, file location in email to the team for evry 10 mins or any other time interval.
Yes its kind of intresting project. The main aim of it is to reduce the number of emails send to the team. Before team gets an email for every message in the queue.
I will use Timer nodes to run the flow for evry certain time interval.
I need your suggetions on how I can read the messages from the queue for certain time interval and iterate through each message to find the required element value(which dept) and move the messages to the files. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue May 31, 2011 9:11 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Use a Singleton to track the counter. Implement JMX to provide real-time reporting. Use Java sendmail from within the Singleton to send the messages. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 31, 2011 9:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
puja0830 wrote: |
Yes its kind of intresting project. The main aim of it is to reduce the number of emails send to the team. Before team gets an email for every message in the queue. |
And the point of these emails is to report what?
puja0830 wrote: |
I will use Timer nodes to run the flow for evry certain time interval.
I need your suggetions on how I can read the messages from the queue for certain time interval |
Use another Timer node to stop the flow again. Or a cron job. Or any other scheduling tool. As I've said before, a lot depends on how often the time interval changes.
I remain uncertain why you're not just reading these messages as they arrive. If you're trying to report on messages per time interval, why not add the details to a database which could then provide historical trends and pretty metrics?
puja0830 wrote: |
iterate through each message to find the required element value(which dept) and move the messages to the files. |
This is (again) WMB 101. It's a simple (very simple) parse of the XML. Think. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 31, 2011 9:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
Use a Singleton to track the counter. Implement JMX to provide real-time reporting. Use Java sendmail from within the Singleton to send the messages. |
Or if you don't fancy Java, use WMB Monitoring and/or the EmailOutput node.
Many, many ways to achive this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
puja0830 |
Posted: Tue May 31, 2011 9:27 am Post subject: |
|
|
Newbie
Joined: 31 May 2011 Posts: 9
|
I request you all to guide me on this.
How Can I Iterate through all the messages and route the message to different files based on field in the message(XML fromat) for every cerain time interval.
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 31, 2011 9:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
puja0830 wrote: |
I request you all to guide me on this. |
This isn't guiding, this is training and/or producing the code for you. It's not difficult to do what you're suggesting. Especially the routing of the messages, where the Route node is an obvious (but not the only, or even the best) choice.
What have you built so far? Why doesn't it meet your requirements? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue May 31, 2011 9:39 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
puja0830 wrote: |
I request you all to guide me on this.
How Can I Iterate through all the messages and route the message to different files based on field in the message(XML fromat) for every cerain time interval.
Thanks |
Me thinks, we could suggest he attend a WMB Developer class? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Tue May 31, 2011 9:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
we could suggest he attend a WMB Developer class? |
If you're going to suggest that everytime someone asks a basic WMB question, I recommend you have it in a text file so you can cut & paste it as you're likely to be doing it a lot.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue May 31, 2011 10:00 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
He can keep it filed neatly (in Source Control naturally) alongside the one that mentions a Singularity.
TIC  _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue May 31, 2011 10:10 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
puja0830 |
Posted: Tue May 31, 2011 3:03 pm Post subject: |
|
|
Newbie
Joined: 31 May 2011 Posts: 9
|
Hi All,
So far I have implemented it with database. As soon as there is a message in queue, I can able to parse and get the required element valie(i.e Dept - Sale or Financial) from the message, storing it in database. When ever schedule for the reprort - using timer nodes, can able to query database to get required report.
But my team lead said not to use database, thats why iam looking for other options.
How can I read all the messages for every 10 or 15 mins in WMB and how can I iterate through each message. I just need suggestion in this. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue May 31, 2011 7:39 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
puja0830 wrote: |
Hi All,
So far I have implemented it with database. As soon as there is a message in queue, I can able to parse and get the required element valie(i.e Dept - Sale or Financial) from the message, storing it in database. When ever schedule for the reprort - using timer nodes, can able to query database to get required report.
But my team lead said not to use database, thats why i am looking for other options.
How can I read all the messages for every 10 or 15 mins in WMB and how can I iterate through each message. I just need suggestion in this. |
Beats the **** out of me why your team lead said not to use a db. A db is an ideal solution for reporting as it lets the recipient of the report choose the interval... You might need to construct a monitoring flow that goes to the db and an automatic process that moves fine grained data to coarse grained data...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|