Author |
Message
|
zlj |
Posted: Sun Nov 16, 2008 5:47 pm Post subject: how to create a queue manager programly? |
|
|
 Apprentice
Joined: 13 Nov 2008 Posts: 32
|
As I know, amdmdnet.dll supply API to access IBM WebSphere MQ, including queue manage and channel manage and so on.
The problem is I cannot find the command for creating a queuemanager.
Should I use DOS command to do this?
Code: |
crtmqm –q QMgrName
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Nov 16, 2008 6:08 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Yes it will be a dos command. On windows check out amqmdain on Unix crtmqm. Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
zlj |
Posted: Sun Nov 16, 2008 6:40 pm Post subject: |
|
|
 Apprentice
Joined: 13 Nov 2008 Posts: 32
|
fjb_saper wrote: |
Yes it will be a dos command. On windows check out amqmdain on Unix crtmqm. |
I was remain perplexed despite much thought why not provide API to do this? That will be much easier.
Thank you very much. |
|
Back to top |
|
 |
zlj |
Posted: Sun Nov 16, 2008 9:28 pm Post subject: |
|
|
 Apprentice
Joined: 13 Nov 2008 Posts: 32
|
Share my code, and give some advice please.
Code: |
#region 命名空间
#endregion
namespace MQSeriesComponent
{
internal class DOSHelper
{
public static void ExcuteCommand(params string[] cmds)
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
foreach (string cmd in cmds)
{
p.StandardInput.WriteLine(cmd);
}
p.StandardInput.WriteLine("Exit");
p.WaitForExit();
p.Close();
}
}
}
|
Code: |
namespace MQSeriesLibrary.MQSeriesComponent
{
public class MQSeriesHelper
{
public static void CreateQueueManager(string queueManagerName)
{
string cmd = string.Format("crtmqm -q {0}", queueManagerName);
DOSHelper.ExcuteCommand(cmd);
}
public static void StartQueueManager(string queueManagerName)
{
string cmd = string.Format("strmqm {0}", queueManagerName);
DOSHelper.ExcuteCommand(cmd);
}
public static void StopQueueManager(string queueManagerName)
{
string cmd = string.Format("endmqm -i {0}", queueManagerName);
DOSHelper.ExcuteCommand(cmd);
}
public static void DeleteQueueManager(string queueManagerName)
{
StopQueueManager(queueManagerName);
string cmd = string.Format("dltmqm {0}", queueManagerName);
DOSHelper.ExcuteCommand(cmd);
}
}
} |
|
|
Back to top |
|
 |
mqjeff |
Posted: Mon Nov 17, 2008 3:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Don't use endmqm -i unless you have to. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Nov 17, 2008 3:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
zlj wrote: |
I was remain perplexed despite much thought why not provide API to do this? That will be much easier.
|
Writing a piece of code to encapsulate an API is easier than typing "crtmqm"????
Remember that creating a queue manager is very much a one-off administration activity.
Also as previously posted don't use endmqm -i unless you have to. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zlj |
Posted: Mon Nov 17, 2008 5:54 pm Post subject: |
|
|
 Apprentice
Joined: 13 Nov 2008 Posts: 32
|
Vitor wrote: |
Writing a piece of code to encapsulate an API is easier than typing "crtmqm"????
Remember that creating a queue manager is very much a one-off administration activity.
Also as previously posted don't use endmqm -i unless you have to. |
We have thousand client to deploy. The MQ configuration due to data in database(Oracle,SQL...), customer/client needs to config MQ itself, for MQ often need to change. A user should not typing "crtmqm" beacause he/she is not a admin but he/she should manage MQ. Since we need a auto-deployment application, base on database. User should click button, not typing dos command.
Vitor wrote: |
Also as previously posted don't use endmqm -i unless you have to.
. |
When I want to detroy a QM, I was ensure there is no message in queue or the message is useless. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Nov 18, 2008 2:28 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
zlj wrote: |
We have thousand client to deploy. |
I'm taking it here that you mean client in the business sense.
What I would do is wrap the crtmqm in an installer process of some kind that reads the configuration, generates and spawns the dos commands. So the app itself isn't creating the queue manager, but is using an internal exec to do it
zlj wrote: |
Vitor wrote: |
Also as previously posted don't use endmqm -i unless you have to.
. |
When I want to detroy a QM, I was ensure there is no message in queue or the message is useless. |
Using endmqm -i doesn't destroy a queue manager. Nor does it have any effect on the queue objects or the messages they may or may not contain. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zlj |
Posted: Tue Nov 18, 2008 6:10 pm Post subject: |
|
|
 Apprentice
Joined: 13 Nov 2008 Posts: 32
|
Vitor wrote: |
What I would do is wrap the crtmqm in an installer process of some kind that reads the configuration, generates and spawns the dos commands. So the app itself isn't creating the queue manager, but is using an internal exec to do it
|
Not only for installation, but also for modify one day.
EG:
Server have many remote queue for sending message to client, client info storaged in database. One day a client no needed, customer delete the remote queue, MQ manager will not. In the same way, customer can add a remote queue, XMITQ,channel,define trigger of XMITQ to send message to a new client. While they do not need MQ admin.
Vitor wrote: |
Using endmqm -i doesn't destroy a queue manager. Nor does it have any effect on the queue objects or the messages they may or may not contain. |
If I want to delete a QM completely, what should I do? |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue Nov 18, 2008 8:02 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
|
Back to top |
|
 |
zlj |
Posted: Tue Nov 18, 2008 9:03 pm Post subject: |
|
|
 Apprentice
Joined: 13 Nov 2008 Posts: 32
|
Thank you all very much.
Have a good day! |
|
Back to top |
|
 |
Vitor |
Posted: Wed Nov 19, 2008 1:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
zlj wrote: |
Vitor wrote: |
What I would do is wrap the crtmqm in an installer process of some kind that reads the configuration, generates and spawns the dos commands. So the app itself isn't creating the queue manager, but is using an internal exec to do it
|
Not only for installation, but also for modify one day.
EG:
Server have many remote queue for sending message to client, client info storaged in database. One day a client no needed, customer delete the remote queue, MQ manager will not. In the same way, customer can add a remote queue, XMITQ,channel,define trigger of XMITQ to send message to a new client. While they do not need MQ admin. |
Typically you'd set up new objects like this using remote administration; rather than push out a new build of the queue manager, you'd send the new objects. But you could do it your way, just by extending the concept you're using.
Vitor wrote: |
Using endmqm -i doesn't destroy a queue manager. Nor does it have any effect on the queue objects or the messages they may or may not contain. |
If I want to delete a QM completely, what should I do?[/quote]
The delete command dltmqm? You'll find it documented where you found the endmqm command, but in the "d" commands not the "e" ones. If you're using the online info centre I believe there's a hyperlink at the bottom of the endmqm command, in the section "related commands".
You should be able to find it quite easily. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|