-
1. Re: Why connection.start() need to be called before consumer
ataylor Nov 12, 2009 11:12 AM (in response to anthonylee)because this is what the JMS spec says it should do :).
connection.start() Starts (or restarts) a connection's delivery of incoming messages.
So you only need it for consumers. -
2. Re: Why connection.start() need to be called before consumer
timfox Nov 12, 2009 11:16 AM (in response to anthonylee)See the JMS javadoc:
http://java.sun.com/javaee/5/docs/api/javax/jms/Connection.html#start%28%29 -
3. Re: Why connection.start() need to be called before consumer
anthonylee Nov 12, 2009 11:18 AM (in response to anthonylee)Oh, I see.
Thanks ataylor and tim. -
4. Re: Why connection.start() need to be called before consumer
anthonylee Nov 12, 2009 11:23 AM (in response to anthonylee)So, why the JMS spec make connection.start() for producer.send() implicit but make it explicit for consumer.receive()?
-
5. Re: Why connection.start() need to be called before consumer
timfox Nov 12, 2009 11:38 AM (in response to anthonylee)"anthonylee" wrote:
So, why the JMS spec make connection.start() for producer.send() implicit but make it explicit for consumer.receive()?
Connection.start() just means "start *delivering* any messages on this connection", so clearly it's meaningless when applied to *sending* messages. -
6. Re: Why connection.start() need to be called before consumer
anthonylee Nov 12, 2009 1:11 PM (in response to anthonylee)Hi Tim,
Thanks for reply, it helps me understand it clearly.
My confusion came from that I thought *delivery* include sending message too.
Actually, it just means the Queue/Topic begin to allow consumer to receive message.
I tested it, without connection.start(), consumer.receive() didn't receive any message.
Thanks again! -
7. Re: Why connection.start() need to be called before consumer
timfox Nov 12, 2009 1:20 PM (in response to anthonylee)Glad to be of help.
In messaging delivery usually means the transfer of messages from the messaging system to any recipients, whereas sending/publishing/posting is the transfer of messages from the client to the messaging system.
This is similar terminology to how a postal system operates.
When you post a letter, you post it into the post box, you wouldn't say you deliver it to the post box.
The mail company then delivers the message to the recipient. -
8. Re: Why connection.start() need to be called before consumer
anthonylee Nov 12, 2009 1:26 PM (in response to anthonylee)Yes, that is exactly what I was thinking: Postal system.
When you just move to another place, you may inform the post office to hold your mails for 1 month, and then you settle down in new place and tell the post office to begin to deliver mails to new place. -
9. Re: Why connection.start() need to be called before consumer
anthonylee Nov 12, 2009 1:35 PM (in response to anthonylee)The last question is:
For Message Driven Bean, is there a way to start connection like a standalone consumer? -
10. Re: Why connection.start() need to be called before consumer
ataylor Nov 13, 2009 5:15 AM (in response to anthonylee)The connection will be started when the MDB is deployed. This is controlled by the J2EE layer not hornetq.