• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pause and listener  RSS feed

 
Thomas Beaujard
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm building a stand alone program, which can be called a listener as it waits for new message. I have two questions about it
:
First, I'd like to make a pause in the listener without using thread, is it possible?

Then I don't like the fact that I'll have to start a java command everyday to start the listener. I was wondering if there was a nicer way to do it. The platform is an AIX server with WAS, I thought maybe the listener could start in the same time as the WAS, any idea?

Cheers
Thom
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For part 1, what kind of protocol do the messages and listener use? You may wind up with blocking IO so waiting for a message is more or less built in.

For part 2, Sounds like you're running this outside the J2EE container. A scheduler like Quartz might be good to just start up your process every day. How does your J2EE container get started? Maybe you can add one more line to a startup script?

If you want to get this into your J2EE container, the specs forbid you from running your own threads but each J2EE vendor has some proprietary workaround. WAS has WorkManager which I think lets you spawn custom threads.

If you can use JMS for your protocol, then Message Driven Beans might be a good solution for both parts 1 and 2.

Any of that match up with your problem?
[ May 07, 2007: Message edited by: Stan James ]
 
Thomas Beaujard
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I receive MQ message so the protocol is JMS, however, I use a proprietary home-made client API. So I don't know if Message driven bean will be suitable, I have to check.
What do you mean by blocking IO?

Thanks for your helpful answers.

Thom
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Blocking IO would apply if you accepted messages over sockets or ... well I don't know what other protocols would wait.

JMS is very cool for asynchronous messaging. Message Driven Beans are only available in an EJB container ... you didn't say if you have one or not. Outside of EJB land you can write straight JMS API code to accept inbound messages.

Do you have some design ideas or something that almost works? I'll only dig myself into a hole if I keep guessing at what you might need.
 
Thomas Beaujard
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if we're gonna use an EJB container. Anyway, since we're using a home made API to get our message, I think I will create a stand alone java application which will listens for new messages. I will launch this listeners in the starting script of WAS and that should do the trick.
I think I've got all the answers I need.
Thanks very much.

Thom
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!