Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes JMS: Why are these examples working when I'm not calling connection.start() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS: Why are these examples working when I Watch "JMS: Why are these examples working when I New topic
Author

JMS: Why are these examples working when I'm not calling connection.start()

Rick Reumann
Ranch Hand

Joined: Apr 03, 2001
Posts: 281
According to the API on Connection API and from other docs I've seen, it is mentioned that:

"When a Connection is created it is in stopped mode. That means that no messages are being delivered."

"It is typical to leave the Connection in stopped mode until setup is complete. At that point the Connection's start() method is called and messages begin arriving at the Connection's consumers."

What I don't understand is I actually have some code where I do not ever call connection.start() in either my client or my MDB and everything works. It's actually an example that I followed from the 'JBoss At Work: A Practical Guide' book. (The 'EJB3 In Action' book also does not mention ever calling connection.start() either, so I'm confused what's going on. I figured maybe when connection.close() was called it automatically started the flow of messages, but the API doesn't mention that.

How are these examples working without ever explicitly calling connection.start()
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JMS: Why are these examples working when I'm not calling connection.start()