10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

An Application ExampleThat Deploys a Message-Driven Bean onTwo Servers<br />

ReplyListener: Received message: id=1, text=ReplyMsgBean processed message: text: id=1 to local<br />

app server<br />

Sent message: text: id=3 to local app server<br />

ReplyListener: Received message: id=3, text=ReplyMsgBean processed message: text: id=3 to local<br />

app server<br />

ReplyListener: Received message: id=2, text=ReplyMsgBean processed message: text: id=2 to remote<br />

app server<br />

Sent message: text: id=4 to remote app server<br />

ReplyListener: Received message: id=4, text=ReplyMsgBean processed message: text: id=4 to remote<br />

app server<br />

Sent message: text: id=5 to local app server<br />

ReplyListener: Received message: id=5, text=ReplyMsgBean processed message: text: id=5 to local<br />

app server<br />

Sent message: text: id=6 to remote app server<br />

ReplyListener: Received message: id=6, text=ReplyMsgBean processed message: text: id=6 to remote<br />

app server<br />

Sent message: text: id=7 to local app server<br />

ReplyListener: Received message: id=7, text=ReplyMsgBean processed message: text: id=7 to local<br />

app server<br />

Sent message: text: id=8 to remote app server<br />

ReplyListener: Received message: id=8, text=ReplyMsgBean processed message: text: id=8 to remote<br />

app server<br />

Sent message: text: id=9 to local app server<br />

ReplyListener: Received message: id=9, text=ReplyMsgBean processed message: text: id=9 to local<br />

app server<br />

Sent message: text: id=10 to remote app server<br />

ReplyListener: Received message: id=10, text=ReplyMsgBean processed message: text: id=10 to remote<br />

app server<br />

Waiting for 0 message(s) from local app server<br />

Waiting for 0 message(s) from remote app server<br />

Finished<br />

Closing connection 1<br />

Closing connection 2<br />

On the local system, where the message-driven bean receives the odd-numbered messages, the<br />

output in the server log looks like this (wrapped in logging information):<br />

ReplyMsgBean: Received message: text: id=1 to local app server<br />

ReplyMsgBean: Received message: text: id=3 to local app server<br />

ReplyMsgBean: Received message: text: id=5 to local app server<br />

ReplyMsgBean: Received message: text: id=7 to local app server<br />

ReplyMsgBean: Received message: text: id=9 to local app server<br />

On the remote system, where the bean receives the even-numbered messages, the output in the<br />

server log looks like this (wrapped in logging information):<br />

ReplyMsgBean: Received message: text: id=2 to remote app server<br />

ReplyMsgBean: Received message: text: id=4 to remote app server<br />

ReplyMsgBean: Received message: text: id=6 to remote app server<br />

Chapter 32 • <strong>Java</strong> <strong>EE</strong> Examples Using the JMS API 983

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!