Author |
Message
|
mca |
Posted: Wed Apr 13, 2005 12:51 pm Post subject: invoking application program(java) by UPES |
|
|
Disciple
Joined: 09 Mar 2005 Posts: 196
|
hi,
My aim is to execute an application program(java) when an message is put on UPES Queue. For this i am triggering MQget.java which inturn calls MessageParser.java and AppPro.java. For one instance of UPES steps 2 java programs are invoked at one time(MQGet&MessageParser) / (MQGet&AppPro). This has no problem if there are less instances invoking this application.
If i have 300 instance of UPES steps 300 MQget.java gets triggered at a time and 300*2 = 600 java programs will be invoked at same time(worst case). Isn't this considered as an overhead for the java environment ?
Like is there any other feasible way of doing this task ? |
|
Back to top |
|
 |
mqmhr |
Posted: Wed Apr 13, 2005 8:42 pm Post subject: |
|
|
Centurion
Joined: 28 Dec 2004 Posts: 105
|
If you can use PEA nstead of UPES for the tasks, you could use the Java High Performance Bridge. Using JHPB, activity implementations could be cached. An explanation for this could be found in the XML programing guide. |
|
Back to top |
|
 |
David |
Posted: Wed Apr 13, 2005 10:03 pm Post subject: |
|
|
Novice
Joined: 20 Mar 2002 Posts: 10
|
I'm not sure I fully understand your solution. I would suggest the best way to implement a UPES is to create one thread which listens to the inbound queue. When a message arrives the message is removed and passed to a worker thread for processing. The worker thread sends the response to Workflow.
If you have a high throughput activity then you might want to either ensure the server has multiple CPUs to ensure the multiple worker threads can work in true parallel. The other choice is to look at MQ clustering to spread the work out over multiple machines.
I'm not sure what you mean by "600 java programs will be invoked at same time(worst case)". Can you explain further? 600 instances of the JVM would definately be slow.
Hope it helps,
David. |
|
Back to top |
|
 |
vennela |
Posted: Thu Apr 14, 2005 4:01 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
You have to use the trigtype of FIRST instead of EVERY and the application should be changed accordingly. Your application should recursively GET until there are no messages |
|
Back to top |
|
 |
karthik |
Posted: Thu Apr 14, 2005 7:40 am Post subject: |
|
|
 Centurion
Joined: 17 Oct 2003 Posts: 114
|
Hi
As Vennela said , if the trigger type is first , the java program is immediately triggered when a message appears on the queue.
I am assuming that you are expecting that , what happens if this UPES puts 300 messages on your UPESQ.
It probably will not happen , since from your explanation , it appears a Synchronous UPES , and workflow will expect a response from your java program and only then will move forward.The next message on this Q will appear only , in the next iteration.
I guess the other situation i can think of is that if you force restart , this UPES activity 300 times , may be that's possible (not sure of that).
So, i am assuming you probably are safe here.
Thanks
Karthik |
|
Back to top |
|
 |
mca |
Posted: Thu Apr 14, 2005 8:02 am Post subject: |
|
|
Disciple
Joined: 09 Mar 2005 Posts: 196
|
thanks all for ur suggestions.
Until now i was planning to trigger an .sh/.exe file when an message is put on an queue. But i learn if 300 such message occur at a time 300 .sh/.exe files needs to be triggered and they inturn call the Java application program where 300 independent processes are created and it is definately an overhead to the server.
So, i heard there is a better way of doing this. Like running JMS Listener which is bound to the UPES Q and continuously listening. Now i need to configure JNDI for establishing connection. So, Can anyone provide the details of JNDI configuration. |
|
Back to top |
|
 |
vennela |
Posted: Thu Apr 14, 2005 8:45 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
MCA:
You are missing the point again.
A listener -- What does it do --
1. See if there are any messages
>>>>Yes
process it
go back to 1.
<<<<<NO
sleep for 30 seconds
go back to 1.
If you setup the trigger the trigger program also should do the same.
As soon as a message is put on the queue, the trigger monitor sees that and invokes the application. Now the trigger type is first so it will trigger only when the message count on the queue goes from 0 to 1 and if the queue is not opened for get.
How your program should look like in this scenariio:
1. See if there are any messages
>>>>Yes
process it
go back to 1.
<<<<<NO
end
What you are talking about and whoever suggested you to use the JMS listener, I think is a Message Driven Bean, and for this you need an application server like WebSphere Application Server.
Let me tell you in brief how this works.
You have to configure the MDB to listen to a queue. As soon as a message arrives on a queue, a method called onMessage in MDB is invoked and you have to write the processing logic inside this method or call some other method inside this method. |
|
Back to top |
|
 |
mca |
Posted: Thu Apr 14, 2005 11:24 am Post subject: |
|
|
Disciple
Joined: 09 Mar 2005 Posts: 196
|
Thanks for ur suggestions vennela, karthik and David. They are of very use to me. With all the confusion i had what i figured out now is...plzz correct me if wrong
Change the trigger type from "every" to "First" and change the code in MQGet in such a way that it recursively checks for messages in Queue until NONE and if any then, start a thread to run the java application program and return back to check for messages. If none then wait for message using trigger monitor for next FIRST message. In this way, if 300 messages are put in Q once we can avoid triggering 300 times and rather start 300 thread to execute the java application program by the method of recursive checking.
Any suggestion or correction to the idea greatly appreciated ... |
|
Back to top |
|
 |
jmac |
Posted: Thu Apr 14, 2005 12:53 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Sounds right to me. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
|