Renaming Queue in Websphere MQ - ibm-mq

Can we rename a Queue without deleting and recreating it?

It is not possible to rename a WebSphere MQ queue. There are two options:
You can define an alias over an existing queue where the alias has the desired name.
You can define a new queue with the desired name and move any messages into it from the original queue.
In the event that you take the second option, there are a number of tools to move the messages. Two of the more popular tools are mqmon from SupportPac MO71 and the Q program from SupportPac MA01.

Related

Copy MQ Messages from one Queue to another

Question:
Is it possible to copy MQ Messages from one Queue Manager/Queue to a different Queue Manager/Queue?
Scenario:
I have a "PROD" Queue Manager and when it receives a Message on it's Queues I would like to "copy" the Message to a queue on a "TEST" Queue Manager.
Requirements
The original message must be left on the PROD queue to be processed as normal.
This must be an automated process (lots of messages during a day). I could not intervene on a Message by Message basis.
If at all possible I would like this to be implemented by some native MQ functionality rather than an ad hoc program/script.
The copying must be as near to real time as possible
Must work with MQ version is 7.0.2.1(!). This cannot be changed.
Must run on Red Hat Enterprise Linux Server release 5.11 (Tikanga). Again, can't be changed.
I'm no MQ expert so use small words please
Thanks in advance
The only problem with the technote pointed out by gouda is that MQ will modify/changed the MsgId and CorrelId of each message replicated.
If the MsgId and/or CorrelId fields are important then the only other option is an MQ API Exit that replicates the message. You may need a commercial product like MQ Message Replication.
The next question is how are you going to move the message from a PROD queue to a TEST queue? You definitely do NOT want to create channels between a PROD queue manager and a TEST queue manager.
There are lots of tools that can off offload PROD messages to a file then you can move the file to your TEST environment and then load the messages into a TEST queue. Here is a list of MQ tools that can do it. The 2 tools you should try out are: MQ Batch Toolkit and QLoad.
Personally, I would create a schedule task (CRONTAB) to be run every night at midnight to off the messages and I would make the filename include the date and time. The last steps of the script would be to zip/compress the file and delete the original file (because the data you offload could be massive).
Hence, any time you want a particular day's PROD messages, just copy the file to your TEST server and unzip/uncompress it and load it into the queue.
all you need is mqadmin staff and this technote

Rename tibco queue by command line

I been looking in google without success.
I´m connected to tibco machine by console, and I would like to rename a queue name.
show queue
Give me all the details of the queue. I would like to rename it.
AFAIK, You can't rename queues.
To achieve the same as "renaming" a queue you'd need to:
disconnect consumers from the old queue
create the new queue
move any pending messages from the old queue to the new one
create a bridge from the old q. to the new q.
reconnect consumers to the new queue
delete bridge and old queue when no longer referenced by any producer.
if you are in your own dev environment, just delete the old queue and create the new one (assume you don't care losing pending messages in that case)

WMQ replicate message to another queue

I have 2 queues say Q1 and Q2. When I insert messages using MQPUT into Q1, is there any way that this message be replicated into Q2?
Does WMQ have support for queue copy?
Note : The queues reside on different queue managers.
Thanks,
Hudson
If you have multiple consumers(Queues), which needs the same message, then Publish-Subscribe is made exactly for this purpose.
You can refer here for details about pub-sub.
If you are using Websphere MQ 7.XX, then you can use an Alias queue to publish the message.
You can follow below steps:
Create a new Topic(Lets say "MyTopic" is your topic).
Create an Alias queue(Lets call it as "MyPublisher"), with Base Type as Topic and give Base Object as "MyTopic"(Name of your topic).
Now say Q1, Q2, Q3 have to get the message. Create subscriptions for these queues for Topic "MyTopic".
Now, the messages posted in queue "MyPublisher", will reach to all queues subscribing to the topic "MyTopic"(Q1,Q2,Q3).
Even remote queues can be given in destination while creating subscriptions. So, different queue managers will not be a problem as far as you have connectivity between them.
If you don't want to bother with all of the Pub/Sub stuff, then have a look at the free open source project Message Multiplexer (MMX) at http://www.capitalware.biz/mmx_overview.html
Its purpose is to read messages from a source queue and put the exact same message to 'n' target queues (up to 99).
The download contains builds for AIX, HP-UX, Linux, IBM i (OS/400), Solaris, Windows and z/OS (mainframe).
MMX is a very simple and straight-forward program to use.

Executing file to queue transfer with order?

We are currently implementing mq fte solution
One of the projects need to executive file to queue function because the target system reads only from mq .
We are looking for a way not only upload the files to queue but to keep the order of the files too.
We need that the oldest file will be uploaded first ( by modification or creation date ) and the the oldest file after him in the folder
Someone had this request on fte ? How did you handle it ?
The source system is windows .
Thanks for the assistance .
That depends on your setup. Is there a single queue manager in your scenario? Does the source system share the same local queue manager with the target system?
The order of messages might be guaranteed by default, as the MQ v7 Infocenter states in chapter Priority, in these cases:
If an application puts a sequence of messages on a queue, another
application can retrieve those messages in the same order that they
were put, provided:
The messages all have the same priority
The messages were all put within the same unit of work, or all put outside a unit of work
The queue is local to the putting application
If these conditions are not met, and the applications depend on the messages
being retrieved in a certain order, the applications must either
include sequencing information in the message data, or establish a
means of acknowledging receipt of a message before the next one is
sent.
If you do not meet these requirements (for example when the communication spans multiple queue managers), you can meet the requirements by:
ensuring that next message is put if and only if the recipient confirmed getting the previous one (for example by a MQ reply message)
using Message Groups to retrieve messages in logical order - that requires setting GroupId and MsgSeqNumber in the MQMD by the putting application and subsequently using MQGMO_LOGICAL_ORDER option by getting application (see chapter Logical and Physical ordering)

MQ (Websphere 7) persist message to file system

How would I set up MQ so that every message received is immediately written to file system?
I have the "redbooks", but at least need someone at least point me to a chapter or heading in the book to figure it out.
We are a .NET shop. I have written C# via API to read the queue, and we currently use BizTalk MQ adapter. Our ultimate goal is to write same message to multiple directories in file system to "clone" the feed for our various test environments (DEV, STAGE, TRAINING, etc..). The problem with BizTalk is that when we consume the message, we map it at the same time to a new message, so the message is already changed, and we want the original raw message to be cloned, not the morphed one. Our vendors don't offer multiple copies of the feed, for example, they offer DEV and PROD, but we have 4 systems internally.
I suppose I could do a C# Windows Service to do it, but I would rather use built-in features of MQ if possible.
There is no configuration required. If the message is persistent, WMQ writes it to disk. However, I don't think that's going to help you because they are not written as discrete messages. There's no disk file to copy and replication only works if the replicated QMgr is identical to the primary and is offline during the replication.
There are a number of solutions to this problem but as of WMQ V7, the easiest one is to use the built-in Pub/Sub functionality. This assumes that the messages are arriving over a QMgr-to-QMgr channel and landing on a queue where you then consume them.
In that case, it is possible to delete the queue and create an alias of the same name over a topic. You then create a new queue and define an administrative subscription that delivers messages on the topic into the new queue. Your app consumes from the new queue.
When you need to send a feed to another QMgr or application, define a new subscription and point it at the new destination queue. Since this is Pub/Sub, MQ will replicate the original message as many times as there are subscriptions and the first application and its messages are not affected. If the destination you need to send to isn't accessible over MQ channels (perhaps DEV and QA are not connected, for example), you can deliver the messages to the new queue, use QLoad from SupportPac MO03 to write them to a file and then use another instance of QLoad to load them onto a different QMgr. If you wanted to move them in real time, you could set up the Q program from SupportPac MA01 to move them direct from the new subscription queue on QMgr1 to the destination queue on QMgr2. And you can replicate across as many systems as you need.
The SupportPacs main page is here.
If all you are using is the Redbooks, you might want to have a look at the Infocenters. Be sure to use the Infocenter matching the version of WMQ you are using.
WMQ V7.0 Infocenter
WMQ V7.1 Infocenter
WMQ V7.5 Infocenter

Resources