Date Created: Wed 20-Feb-2008

Related Document Categories:

Get my WebSphere MQ course here >> http://www.themiddlewareshop.com/products/


WebSphere MQ V6 Fundamentals (sg247128)

I often find that the red book examples may not show enough reality when it comes to using MQ on Linux, so I am attempting to edit the samples transcripts as provided in the IBM Redbook on pages 216 - 265. Below I will be tidying up a complete walk through with commentary on why we would want to do the things the transcripts demonstrates and how we can use MQ Explorer from a Windows machine which will connect to the remote queues as defined on my test Linux server to view what is happening.

I personally do not like to use a Windows MQ server for demonstration purpose as UNIX is closer to a production reality.

A sample walk through of the red book MQ examples:

crtmqm -q host1/qm1

strmqm

dspmq

runmqsc

DEFINE QLOCAL('queue1') +
DESCR('Redbook example queue1: Newly defined')

end

To replace:

DEFINE QLOCAL('queue1') REPLACE +
DESCR('Redbook example queue1: Newly defined')

------------------------

runmqsc
DISPLAY QLOCAL(*)

DISPLAY QLOCAL('queue1')

DISPLAY QLOCAL('queue1') ALL

DISPLAY QLOCAL('queue1') DEFPSIST DESCR CURDEPTH

ALTER QLOCAL('queue1') +
DESCR('Redbook example queue1: Altered description')

DISPLAY QLOCAL('queue1') DESCR

end

--------------------------


-bash-3.1$ /opt/mqm/samp/bin/amqsput queue1
Sample AMQSPUT0 start
target queue is queue1

mqrc code

-------------------------

/opt/mqm/samp/bin/amqsbcg queue1 > queue1.txt


AMQSBCG0 - starts here
**********************

MQOPEN - 'queue1'


MQGET of message number 1
****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 1208
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120686F7374312F716D31202020D9A3BC47030A0020'
CorrelId : X'000000000000000000000000000000000000000000000000'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'host1/qm1 '
** Identity Context
UserIdentifier : 'mqm '
AccountingToken :
X'0335303200000000000000000000000000000000000000000000000000000006'
ApplIdentityData : ' '
** Origin Context
PutApplType : '6'
PutApplName : 'amqsput '
PutDate : '20080220' PutTime : '22200573'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 7 bytes

00000000: 4865 6C6C 6F20 31 'Hello 1 '


MQGET of message number 2
****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 1208
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120686F7374312F716D31202020D9A3BC47050A0020'
CorrelId : X'000000000000000000000000000000000000000000000000'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'host1/qm1 '
** Identity Context
UserIdentifier : 'mqm '
AccountingToken :
X'0335303200000000000000000000000000000000000000000000000000000006'
ApplIdentityData : ' '
** Origin Context
PutApplType : '6'
PutApplName : 'amqsput '
PutDate : '20080220' PutTime : '22201227'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 7 bytes

00000000: 4865 6C6C 6F20 32 'Hello 2 '

---------------------------

Defining and putting to an alias of a locally hosted queue

This step defines a queue alias object that has a different name that the
previously created queue but references the same queue containing messages.
The attributes of a queue alias object affect the default behavior for messages
put to the target queue. This step shows how specifying a default persistence of
persistent on a queue alias can causes the messages put to a queue through
that queue alias object to be persistent.

runmqsc
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
Starting MQSC for queue manager host1/qm1.


DEFINE QALIAS('queue1.persistent') TARGQ('queue1') DEFPSIST(YES) +
DESCR('Redbook example alias to queue1: For persistent messages') 1 : DEFINE QALIAS('queue1.persistent') TARGQ('queue1') DEFPSIST(YES) +

: DESCR('Redbook example alias to queue1: For persistent messages')
AMQ8006: WebSphere MQ queue created.
end
2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.


runmqsc
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
Starting MQSC for queue manager host1/qm1.


DISPLAY QALIAS('queue1.persistent') TARGQ DEFPSIST DESCR
1 : DISPLAY QALIAS('queue1.persistent') TARGQ DEFPSIST DESCR
AMQ8409: Display Queue details.
QUEUE(queue1.persistent) TYPE(QALIAS)
TARGQ(queue1) DEFPSIST(YES)
DESCR(Redbook example alias to queue1: For persistent messages)



No more messages
MQCLOSE

------------------------------

amqsput queue1.persistent

/opt/mqm/samp/bin/amqsput queue1.persistent
Sample AMQSPUT0 start
target queue is queue1.persistent
Hello 3

Sample AMQSPUT0 end

--------------------------------


endmqm -w host1/qm1



endmqm -w host1/qm1
Waiting for queue manager 'host1/qm1' to end.
Waiting for queue manager 'host1/qm1' to end.
WebSphere MQ queue manager 'host1/qm1' ended.



-----------------------------------

/opt/mqm/samp/bin/amqsbcg queue1 > queue1.txt
-bash-3.1$ cat ./queue1.txt

AMQSBCG0 - starts here
**********************

MQOPEN - 'queue1'


MQGET of message number 1
****Message descriptor****

StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 1208
Format : 'MQSTR '
Priority : 0 Persistence : 1
MsgId : X'414D5120686F7374312F716D31202020D9A3BC47060C0020'
CorrelId : X'000000000000000000000000000000000000000000000000'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'host1/qm1 '
** Identity Context
UserIdentifier : 'mqm '
AccountingToken :
X'0335303200000000000000000000000000000000000000000000000000000006'
ApplIdentityData : ' '
** Origin Context
PutApplType : '6'
PutApplName : 'amqsput '
PutDate : '20080220' PutTime : '22325533'
ApplOriginData : ' '

GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'

**** Message ****

length - 7 bytes

00000000: 4865 6C6C 6F20 33 'Hello 3 '



No more messages
MQCLOSE


-------------------------------

/opt/mqm/samp/bin/amqsget queue1
Sample AMQSGET0 start
message <Hello 3>


no more messages


-------------------------------

DELETE QALIAS('queue1.persistent')

runmqsc
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
Starting MQSC for queue manager host1/qm1.


DELETE QALIAS('queue1.persistent')
1 : DELETE QALIAS('queue1.persistent')
AMQ8007: WebSphere MQ queue deleted.
end
2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.



-----------------------------------


runmqsc
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
Starting MQSC for queue manager host1/qm1.


DISPLAY QUEUE(*)
DISPLAY QALIAS(*) 1 : DISPLAY QUEUE(*)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.ACCOUNTING.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.ACTIVITY.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.CHANNEL.EVENT) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.LOGGER.EVENT) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.PERFM.EVENT) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.QMGR.EVENT) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.STATISTICS.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.ADMIN.TRACE.ROUTE.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.AUTH.DATA.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.CHANNEL.INITQ) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.CHANNEL.SYNCQ) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.CICS.INITIATION.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.CLUSTER.COMMAND.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.CLUSTER.REPOSITORY.QUEUE)
TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.CLUSTER.TRANSMIT.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEAD.LETTER.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.ALIAS.QUEUE) TYPE(QALIAS)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.INITIATION.QUEUE)
TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.MODEL.QUEUE) TYPE(QMODEL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.DEFAULT.REMOTE.QUEUE) TYPE(QREMOTE)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.MQEXPLORER.REPLY.MODEL) TYPE(QMODEL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.MQSC.REPLY.QUEUE) TYPE(QMODEL)
AMQ8409: Display Queue details.
QUEUE(SYSTEM.PENDING.DATA.QUEUE) TYPE(QLOCAL)
AMQ8409: Display Queue details.
QUEUE(queue1) TYPE(QLOCAL)



DEFINE QREMOTE('host1/qm1.alias') RNAME('') RQMNAME('host1/qm1') +
DESCR('Redbook example queue manager alias to host1/qm1') 62 : DEFINE QREMOTE('host1/qm1.alias') RNAME('') RQMNAME('host1/qm1') +

: DESCR('Redbook example queue manager alias to host1/qm1')
AMQ8006: WebSphere MQ queue created.
DISPLAY QREMOTE('host1/qm1.alias') RNAME RQMNAME DESCR
63 : DISPLAY QREMOTE('host1/qm1.alias') RNAME RQMNAME DESCR
AMQ8409: Display Queue details.
QUEUE(host1/qm1.alias) TYPE(QREMOTE)
DESCR(Redbook example queue manager alias to host1/qm1)
RQMNAME(host1/qm1) RNAME( )
end
64 : end

------------------------------


/opt/mqm/samp/bin/amqsput queue1 host1/qm1 8208 0 host1/qm1.alias
Sample AMQSPUT0 start
target queue is queue1
target queue manager is host1/qm1.alias
open options are 8208
hello 4

close options are 0
Sample AMQSPUT0 end



------------------------------
Allow MQ Explorer to connect

DEFINE CHANNEL(SYSTEM.ADMIN.SVRCONN) CHLTYPE(SVRCONN)


DEFINE LISTENER(host1/qm1.listener) TRPTYPE (TCP) PORT(1414)

---------------------------------
Delete queuemanager

endmqm -i host1/qm1
WebSphere MQ queue manager 'host1/qm1' ending.
WebSphere MQ queue manager 'host1/qm1' ended.


dltmqm host1/qm1
WebSphere MQ queue manager 'host1/qm1' deleted.

-----------------------------------

Above is the raw transcript as I manually went through the exercises, to give me ideas on what commentary I might like to add. I will update the transcript above when I next sit down at my laptop next week. March 2008.

Get my WebSphere MQ course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories