Weblogic simple Queue publish and subscribe

This is a total rip from the oracle site, but sometimes other sites content changes. As such, I wanted to post it here after I worked through it and enhanced it a bit.

I created the queue using the admin console and the instructions, changing only the file store to a directory location rather than in memory. In the real world, you would use either a file or a database location to store persistent messages in either a queue or a topic.

We start by posting a message to the queue…

[sa-weblogic@cmhldecomadm01 ~]$ java QueueSend t3://172.28.37.110:7001
Enter message ("quit" to quit):
here comes another'n
JMS Message Sent: here comes another'n

Enter message ("quit" to quit):
quit
JMS Message Sent: quit

…then show the current content in the queue. Notice the one current message…

…then we show the message in the binary queue file…

[sa-weblogic@cmhldecomadm01 ~]$ strings -a /tmp/TESTFILESTORE000000.DAT | grep another
here comes another'n

…then consume the message in the queue…

[sa-weblogic@cmhldecomadm01 ~]$ java QueueReceive t3://172.28.37.110:7001
JMS Ready To Receive Messages (To quit, send a "quit" message).
Message Received: here comes another'n
Message Received: quit

…and finally, show the message is no longer in the queue through the UI…

…and looking at the binary queue file itself…

[sa-weblogic@cmhldecomadm01 ~]$ strings -a /tmp/TESTFILESTORE000000.DAT | grep another
[sa-weblogic@cmhldecomadm01 ~]$

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.