Deploy and run the Producer example:
Right-click the producer project and select Properties.
Select Run from the Categories tree.
In the Arguments field, type the following:
queue 3 |
Click OK.
Right-click the project and select Run.
The output of the program looks like this (along with some application client container output):
Destination type is queue Sending message: This is message 1 from producer Sending message: This is message 2 from producer Sending message: This is message 3 from producer |
The messages are now in the queue, waiting to be received.
When you run an application client, there is usually a noticeable delay between the first two application client container messages and the remainder of the output.
Now deploy and run the SynchConsumer example:
Right-click the synchconsumer project and select Properties.
Select Run from the Categories tree.
In the Arguments field, type the following:
queue |
Click OK.
Right-click the project and select Run.
The output of the program looks like this (along with some application client container output):
Destination type is queue Reading message: This is message 1 from producer Reading message: This is message 2 from producer Reading message: This is message 3 from producer |
Now try running the programs in the opposite order. Right-click the synchconsumer project and select Run.
The Output pane displays the destination type and then appears to hang, waiting for messages.
Right-click the producer project and select Run.
The Output pane shows the output of both programs, in two different tabs.
Now run the Producer example using a topic instead of a queue.
Right-click the producer project and select Properties.
Select Run from the Categories tree.
In the Arguments field, type the following:
topic 3 |
Click OK.
Right-click the project and select Run.
The output looks like this (along with some application client container output):
Destination type is topic Sending message: This is message 1 from producer Sending message: This is message 2 from producer Sending message: This is message 3 from producer |
Now run the SynchConsumer example using the topic.
Right-click the synchconsumer project and select Properties.
Select Run from the Categories tree.
In the Arguments field, type the following:
topic |
Click OK.
Right-click the project and select Run.
The result, however, is different. Because you are using a topic, messages that were sent before you started the consumer cannot be received. (See Publish/Subscribe Messaging Domain, for details.) Instead of receiving the messages, the program appears to hang.
Run the Producer example again. Right-click the producer project and select Run.
Now the SynchConsumer example receives the messages:
Destination type is topic Reading message: This is message 1 from producer Reading message: This is message 2 from producer Reading message: This is message 3 from producer |