队列管理器和MQ中的队列之间的区别

队列管理器和MQ中的队列之间的区别

问题描述:

查看示例代码,看来我需要queue managerqueue name才能通过代码设置MQ.这些之间有什么区别,我可以从中获得这些价值?有什么建议吗?

Looking at the sample codes it seems I need queue manager and queue name to setup MQ through code. What is difference between those and where I can get those values from? Any suggestion?

MQTopicConnectionFactory cf = new MQTopicConnectionFactory();

  // Config
  cf.setHostName("localhost");
  cf.setPort(1414);
  cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
  cf.setQueueManager("QM_thinkpad");
  cf.setChannel("SYSTEM.DEF.SVRCONN");

  MQTopicConnection connection = (MQTopicConnection) cf.createTopicConnection();
  MQTopicSession session = (MQTopicSession) connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
  MQTopic topic = (MQTopic) session.createTopic("topic://foo");
  MQTopicPublisher publisher =  (MQTopicPublisher) session.createPublisher(topic);
  MQTopicSubscriber subscriber = (MQTopicSubscriber) session.createSubscriber(topic); 

您连接到可能承载许多不同队列的队列管理器.因此,是的,应用程序通常需要访问队列管理器,然后再访问该队列管理器上的特定队列.我建议您查看一下Stack Overflow 有关websphere-mq标签的信息,以帮助您入门.这些对象的名称应由您的应用程序设计师/开发人员知道,或者可以通过MQ管理员进行确认.

You connect to a queue manager which may host many different queues. So yes, an application generally needs access to a queue manager and then specific queues on that queue manager. I suggest you can look at the Stack Overflow info for the websphere-mq tag to help get you started. The names of those objects should be known by your application architect/developer or can be confirmed with the MQ admin.