星期五, 1月 19, 2018
generate duplicate messages into other queues
MQ: You want to put a message into a queue and you want to generate duplicate messages into other queues
必須使用pub/sub的功能來間接完成
Question
Scenarios that are addressed in this technote:
1) You are using point-to-point (queues) with your putting and getting applications. You want to use WebSphere MQ (WMQ) Pub/Sub under the covers and you do not want your putting and getting applications to be aware of Pub/Sub. That is, the application that puts messages into a queue continues to put messages into a queue, and the getting applications keep getting messages from a queue.
2) You are using point-to-point and you want to create "duplicate" messages that will be stored in queues Q1 and Q2, when the message is put into the queue "DESTINATION"
1) You are using point-to-point (queues) with your putting and getting applications. You want to use WebSphere MQ (WMQ) Pub/Sub under the covers and you do not want your putting and getting applications to be aware of Pub/Sub. That is, the application that puts messages into a queue continues to put messages into a queue, and the getting applications keep getting messages from a queue.
2) You are using point-to-point and you want to create "duplicate" messages that will be stored in queues Q1 and Q2, when the message is put into the queue "DESTINATION"
Answer
This example uses the new concepts of "topic objects" and "topic alias" introduced in MQ V7.
Use MQ Explorer or amqsput sample to put a message to the DESTINATION queue, which in turn publishes the message into the topic T1 and the subscribers SUB1 and SUB2 receive the messages, which are stored in queues Q1 and Q2 respectively.
You could also publish directly into topic T1.
A copy of the message will be placed on Q1 and Q2.
Use runmqsc to define the following objects:
define ql(Q1)
define ql(Q2)
define qalias(DESTINATION) target(T1) targtype(topic)
define topic(T1) topicstr('TOPIC1')
define sub(SUB1) topicstr('TOPIC1') dest(Q1)
define sub(SUB2) topicstr('TOPIC1') dest(Q2)
Example of running amqsput and amqsget:
a) Open 3 windows:
window 1: get messages from queue Q1
amqsget Q1 QMGR
window 2: get messages from queue Q2
amqsget Q2 QMGR
window 3: put a message into the queue DESTINATION
amqsput DESTINATION QMGR
Sample AMQSPUT0 start
target queue is DESTINATION
TEST
Sample AMQSPUT0 end
b) Observe that Q1 and Q2 receive the same message:
amqsget Q1 QMGR
Sample AMQSGET0 start
message <TEST>
no more messages
Sample AMQSGET0 end
amqsget Q2 QMGR
Sample AMQSGET0 start
message <TEST>
no more messages
Sample AMQSGET0 end
The following is a browse (using: amqsbcg Queue QMGR) of the messages.
Notice that the only differences in this particular example are the last 2 characters from "MsgId" and CorrelId". In your case, more characters in this field could be different.
Message received by Q1:
MsgId : X'414D5120514D5F3730312020202020207064DF4E20003603'
**
CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E08'
**
Message received by Q2:
MsgId : X'414D5120514D5F3730312020202020207064DF4E20003602'
**
CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E0E'
**
c.1) Message received by Q1
****Message descriptor****
StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120514D5F3730312020202020207064DF4E20003603'
CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E08'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'QMGR '
** Identity Context
UserIdentifier : 'rivera '
AccountingToken :
X'16010515000000BA1E06D2603C3514885EDBC2EF03000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '26'
PutApplName : 'QMGR '
PutDate : '20111207' PutTime : '20215396'
ApplOriginData : ' '
GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'
**** Message ****
length - 4 bytes
00000000: 5445 5354 'TEST '
c.2) Message received by Q2
****Message descriptor****
StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120514D5F3730312020202020207064DF4E20003602'
CorrelId : X'414D5120514D5F3730312020202020207064DF4E20001E0E'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'QMGR '
** Identity Context
UserIdentifier : 'rivera '
AccountingToken :
X'16010515000000BA1E06D2603C3514885EDBC2EF03000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '26'
PutApplName : 'QMGR '
PutDate : '20111207' PutTime : '20215396'
ApplOriginData : ' '
GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'
**** Message ****
length - 4 bytes
00000000: 5445 5354 'TEST '
****
若是二個queue 不在同一個qmgr上, 就要利用以下指令來建立 pub/sub hierarchy tree.
alter qmgr parent(parent_qmgr_name)
Connecting a queue manager to a publish/subscribe hierarchy
星期一, 1月 15, 2018
sample tool to test connection with MQ qmgr
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q024090_.htm
http://www-01.ibm.com/support/docview.wss?uid=swg21615875
There is an additional MQ test you can run, The amqscnxc sample connect program included with the MQ samples. You need to have the MQ samples module installed to get this. Source code for the utility is also provided with the samples.
The following test will connect to the queue manager and respond that you are connected/or fail:
amqscnxc -x ConnName -c SvrconnChannelName QMgrName
UNIX: (need the ' ' for the -x option)
amqscnxc -x '192.168.1.131(1415)' -c EXCONN MIKE
Windows: (doesn't need the ' ' for the -x option)
amqscnxc -x 192.168.1.131(1415) -c EXCONN MIKE
*** for the MQ v8, you need to inpurt the user name for the connection, you can set the user id in the MQSAMP_USER_ID environment variable.
MQ V8 - Samples can use user ID and password
https://www.ibm.com/developerworks/community/blogs/messaging/entry/bitesize_blogging_mq_v8_samples_can_use_user_id_and_password?lang=en_us
標籤:
amqscnxc,
connect,
env,
MQ,
MQSAMP_USER_ID,
qmgr,
sample application,
test,
variable
星期二, 12月 19, 2017
如何使用WAS下的scriptLibraries來簡化wsadmin操作
WAS下的scriptLibraries下有一些IBM提供給管理者簡化wsadmin 命令的Library (提供額外的命令來包裝原先複雜的wsadmin 命令), 讓管理可以方便使用。
其使用方法如下﹕(以設定WebContainer thread Pool 為例)
(1)./wsadmin.sh -lang jython -username admin_id -password admin_password
(2)進入wsadmin介面後, 使用execfile來載入擴充的Libraries。
wsadmin>execfile('<WAS-install-root>/scriptLibraries/servers/V70/AdminServerManagement.py')
(3)之後便能使用擴充的指令(至於有哪些指令, 可以自行參考那個.py 檔案的內容說明)
以AdminServerManagement.py 來說其設定Thread Pool的擴充指令為:configureThreadPool
=========================
Ex40: configureThreadPool
# Example 40: Configure thread pool
def configureThreadPool(nodeName, serverName, parentType, tpName, maxSize, minSize, inactivityTimeout, otherAttrList=[], failonerror=AdminUtilities._BLANK_):
其使用方法如下﹕(以設定WebContainer thread Pool 為例)
(1)./wsadmin.sh -lang jython -username admin_id -password admin_password
(2)進入wsadmin介面後, 使用execfile來載入擴充的Libraries。
wsadmin>execfile('<WAS-install-root>/scriptLibraries/servers/V70/AdminServerManagement.py')
(3)之後便能使用擴充的指令(至於有哪些指令, 可以自行參考那個.py 檔案的內容說明)
以AdminServerManagement.py 來說其設定Thread Pool的擴充指令為:configureThreadPool
=========================
Ex40: configureThreadPool
# Example 40: Configure thread pool
def configureThreadPool(nodeName, serverName, parentType, tpName, maxSize, minSize, inactivityTimeout, otherAttrList=[], failonerror=AdminUtilities._BLANK_):
try:
#--------------------------------------------------------------------
# Configuring ThreadPool
#--------------------------------------------------------------------
print "---------------------------------------------------------------"
print " AdminServerManagement: Configuring ThreadPool"
print " nodeName: "+nodeName
print " serverName: "+serverName
print " parentType: "+parentType
print " threadPoolName: "+tpName
print " maximumSize: %s" % (maxSize)
print " minimumSize: %s" % (minSize)
print " inactivityTimeout: %s" % (inactivityTimeout)
===========================
(4)依上面說明, 其正確指令可寫成:
wsadmin>
configureThreadPool("loveNode02","base03","ThreadPoolManager","WebContainer","200","100","60000")
(5)其輸出結果如下﹕
---------------------------------------------------------------
AdminServerManagement: Configuring ThreadPool
nodeName: loveNode02
serverName: base03
parentType: ThreadPoolManager
threadPoolName: WebContainer
maximumSize: 200
minimumSize: 100
inactivityTimeout: 60000
Optional Attributes:
otherAttributeList []
Usage: AdminServerManagement.configureThreadPool("loveNode02", "base03", "ThreadPoolManager", "WebContainer", "'200'", "'100'", "'60000'")
Return: If the command is successful, a value of 1 is returned.
---------------------------------------------------------------
[customProperties []]
[inactivityTimeout 60000]
[isGrowable false]
[maximumSize 200]
[minimumSize 100]
[name WebContainer]
1
(6)若要把這二個步驟合成一個, 就自行寫個abc.py, 其內容如下﹕
execfile('<WAS-install-root>/scriptLibraries/servers/V70/AdminServerManagement.py')
configureThreadPool("loveNode02","base03","ThreadPoolManager","WebContainer","200","100","60000")
(7)最後要執行時就只要去指定abc.py 即可:
./wsadmin.sh -f abc.py
星期二, 11月 28, 2017
How to find out which user issue the MQ command?
(1) enable qmgr command event
alter qmgr cmdev(enabled)
(2) the command event will be put into SYSTEM.ADMIN.COMMAND.EVENT queue
(3) use MH05 SupportPac to parse the command events or
(4) use MS0P SupportPac to format the command events in MQ Explorer
command events
https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.1.0/com.ibm.mq.doc/mo11290_.htm
MH05: WebSphere MQ - Events Display Tool
http://www-01.ibm.com/support/docview.wss?uid=swg24029241
MS0P: WMQ explorer plugin
http://www-01.ibm.com/support/docview.wss?uid=swg24011617
alter qmgr cmdev(enabled)
(2) the command event will be put into SYSTEM.ADMIN.COMMAND.EVENT queue
(3) use MH05 SupportPac to parse the command events or
(4) use MS0P SupportPac to format the command events in MQ Explorer
command events
https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.1.0/com.ibm.mq.doc/mo11290_.htm
MH05: WebSphere MQ - Events Display Tool
http://www-01.ibm.com/support/docview.wss?uid=swg24029241
MS0P: WMQ explorer plugin
http://www-01.ibm.com/support/docview.wss?uid=swg24011617
星期五, 11月 03, 2017
How to find out the high CPU thread for WAS on Windows
follow the CPU high mustgather for Windows platform
http://www-01.ibm.com/support/docview.wss?uid=swg21111364
In the threadsout.txt, the Handle column stands for the thread id. You can use this thread id to find out
the java stack in the javacore files.
http://www-01.ibm.com/support/docview.wss?uid=swg21111364
In the threadsout.txt, the Handle column stands for the thread id. You can use this thread id to find out
the java stack in the javacore files.
星期四, 10月 26, 2017
Install Oracle 11g missing package pdksh-5.2.14 issue
RHEL6 安裝 Oracle 11g 遭遇 pdksh-5.2.14 不存在
http://blog.roodo.com/oraksumi/archives/41081323.html
原因在於 OUI 在進行環境檢查時執行的是下列 command :
----------------------------------------------------------------------------------------
/bin/rpm -q --qf %{version} redhat-release
----------------------------------------------------------------------------------------
在 RHEL6 的環境下 redhat-release 已經被取代為 redhat-release-server-6Server,因此上述 command 會造成了缺少 "elfutils-libelf-devel-0.97" 或是 "pdksh-5.2.14" Package 的錯誤。
解決方式於安裝介質目錄下 database/stage/cvu/cv/admin 找出 cvu_config 這個檔案並且編輯他,將其中的 CV_ASSUME_DISTID=OEL4 改為 CV_ASSUME_DISTID=OEL6 ,如此一來 OUI 便可以正確的檢查系統所需的 Package 了。
由於 "elfutils-libelf-devel-0.97" 或是 "pdksh-5.2.14" 這兩個 Package 並不是必要的,若不想更動 cvu_config 這個檔案,那麼在安裝過程中忽略這個錯誤就可以了。
http://blog.roodo.com/oraksumi/archives/41081323.html
http://blog.roodo.com/oraksumi/archives/41081323.html
原因在於 OUI 在進行環境檢查時執行的是下列 command :
----------------------------------------------------------------------------------------
/bin/rpm -q --qf %{version} redhat-release
----------------------------------------------------------------------------------------
在 RHEL6 的環境下 redhat-release 已經被取代為 redhat-release-server-6Server,因此上述 command 會造成了缺少 "elfutils-libelf-devel-0.97" 或是 "pdksh-5.2.14" Package 的錯誤。
解決方式於安裝介質目錄下 database/stage/cvu/cv/admin 找出 cvu_config 這個檔案並且編輯他,將其中的 CV_ASSUME_DISTID=OEL4 改為 CV_ASSUME_DISTID=OEL6 ,如此一來 OUI 便可以正確的檢查系統所需的 Package 了。
由於 "elfutils-libelf-devel-0.97" 或是 "pdksh-5.2.14" 這兩個 Package 並不是必要的,若不想更動 cvu_config 這個檔案,那麼在安裝過程中忽略這個錯誤就可以了。
http://blog.roodo.com/oraksumi/archives/41081323.html
訂閱:
文章 (Atom)