ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » how to create a queue manager programly?

Post new topic  Reply to topic
 how to create a queue manager programly? « View previous topic :: View next topic » 
Author Message
zlj
PostPosted: Sun Nov 16, 2008 5:47 pm    Post subject: how to create a queue manager programly? Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 16, 2008 6:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
zlj
PostPosted: Sun Nov 16, 2008 6:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
zlj
PostPosted: Sun Nov 16, 2008 9:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Mon Nov 17, 2008 3:30 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Don't use endmqm -i unless you have to.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Nov 17, 2008 3:52 am    Post subject: Reply with quote

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
View user's profile Send private message
zlj
PostPosted: Mon Nov 17, 2008 5:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Nov 18, 2008 2:28 am    Post subject: Reply with quote

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
View user's profile Send private message
zlj
PostPosted: Tue Nov 18, 2008 6:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
PeterPotkay
PostPosted: Tue Nov 18, 2008 8:02 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

zlj wrote:
If I want to delete a QM completely, what should I do?

Use the command to delete a QM.

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.amqzag.doc/fa15550_.htm
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
zlj
PostPosted: Tue Nov 18, 2008 9:03 pm    Post subject: Reply with quote

Apprentice

Joined: 13 Nov 2008
Posts: 32

Thank you all very much.
Have a good day!
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 19, 2008 1:19 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » how to create a queue manager programly?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.