Java Tibco polling

I'm working with custom Tibco listeners that use the MessageConsumer class like this:

Message msg = consumer.receive();

I'd like to implement a shutdown mechanism, so I'd like to replace this with:

Message msg - consumer.receive(1000L);

So repeatedly execute the receive call, and check for a shutdown condition between calls.

Is there any issue with making repeated receive(timeout) calls like this?
jkavxAsked:
Who is Participating?
 
CEHJCommented:
That's good. In that case, running Java in the background is simple, although nonetheless it would be stronger to run your app as a daemon. Use java.util.Timer for your polling and run your app

java MyApp >logfile.log 2>&1 &

Open in new window

0
 
CEHJCommented:
Is there any issue with making repeated receive(timeout) calls like this?

The only thing that could be an issue is (if it's going to run for a long time) that you'd probably want to run it as a daemon
0
 
jkavxAuthor Commented:
It will run usually for about a week.  What will running the listener as a daemon do?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
CEHJCommented:
It'll make less possible to close down accidentally. What OS are you using?
0
 
jkavxAuthor Commented:
Linux.  Our listeners have been running fine for more than a year.  We just call consumer.receive().  To shutdown we publish a shutdown message to the queue.  But now we have a queue that we can't publish to, so we need a different shutdown mechanism.
0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.