How to Receive a Message from an Apache ActiveMQ Topic with ooRexx

W/o Durability

socket = .socket~new()

socket~connect(.inetaddress~new('localhost', 61613))

socket~send('CONNECT' || .string~nl || .string~nl || .string~null)

socket~recv(1000) -- Skip the CONNECTED frame

socket~send('SUBSCRIBE' || .string~nl || 'destination:/topic/SampleTopic' || .string~nl || 'ack:auto' || .string~nl || .string~nl || .string~null)

say socket~recv(1000)

socket~send('DISCONNECT' || .string~nl || .string~nl || .string~null)

socket~close()

::requires 'socket.cls'

W/ Durability

socket = .socket~new()

socket~connect(.inetaddress~new('localhost', 61613))

socket~send('CONNECT' || .string~nl || 'client-id:SampleClient' || .string~nl || .string~nl || .string~null)

socket~recv(1000) -- Skip the CONNECTED frame

socket~send('SUBSCRIBE' || .string~nl || 'destination:/topic/SampleTopic' || .string~nl || 'ack:auto' || .string~nl || 'activemq.subscriptionName:SampleSubscription' || .string~nl || .string~nl || .string~null)

say socket~recv(1000)

socket~send('DISCONNECT' || .string~nl || .string~nl || .string~null)

socket~close()

::requires 'socket.cls'
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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