public void RegisterListener() { try { XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); IConnectionFactory cf = xff.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "localhost"); cf.SetIntProperty(XMSC.WMQ_PORT, 1414); cf.SetStringProperty(XMSC.WMQ_CHANNEL, "MY.SVRCONN"); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.USERID, "userid"); cf.SetStringProperty(XMSC.PASSWORD, "password"); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "QM1"); IConnection conn = cf.CreateConnection(); Console.WriteLine("connection created"); ISession sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge); IDestination dest = sess.CreateQueue(queue); IMessageConsumer consumer = sess.CreateConsumer(dest); MessageListener ml = new MessageListener(onMessage); consumer.MessageListener = ml; conn.Start(); Console.WriteLine("Consumer started"); } catch (Exception ex) { Console.WriteLine(ex); } }
public void ListenForCbcRequests() { try{ _xffReadFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); _connectionFactory = _xffReadFactory.CreateConnectionFactory(); _connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, CBCApplicationConfigurationdetails.RequestConnection); _connectionFactory.SetIntProperty(XMSC.WMQ_PORT, CBCApplicationConfigurationdetails.RequestPort); _connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, CBCApplicationConfigurationdetails.RequestChannel); _connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, CBCApplicationConfigurationdetails.RequestManger); _connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); _connectionFactory.SetStringProperty(XMSC.WMQ_PROVIDER_VERSION, MQConfigurationSettings.WMQ_PROVIDER_VERSION); _mqConnection = _connectionFactory.CreateConnection(); _mqSession = _mqConnection.CreateSession(false, AcknowledgeMode.AutoAcknowledge); _mqDestination = _mqSession.CreateQueue(string.Format("queue://{0}/{1}", CBCApplicationConfigurationdetails.RequestManger, CBCApplicationConfigurationdetails.RequestQueueName)); _mqMessageConsumer = _mqSession.CreateConsumer(_mqDestination); MessageListener ml = OnMessage; _mqMessageConsumer.MessageListener = ml; _mqConnection.Start(); //Thread.Sleep(100000); } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } }
public MQSrMessageQueue() { XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); IConnectionFactory cf = xff.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "ICEKOPAS18"); cf.SetIntProperty(XMSC.WMQ_PORT, 1414); cf.SetStringProperty(XMSC.WMQ_CHANNEL, "SYSTEM.DEF.SVRCONN"); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "FI.CADS"); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_DIRECT_HTTP); cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V2); //cf.SetStringProperty(XMSC.USERID, "mqm"); //cf.SetStringProperty(XMSC.PASSWORD, "mqm"); IConnection conn = cf.CreateConnection(); Console.WriteLine("connection created"); ISession sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge); //IDestination dest = sess.CreateQueue("DOX.APYMT.ESB.SSK.RPO.02"); //IMessageConsumer consumer = sess.CreateConsumer(dest); //MessageListener ml = new MessageListener(OnMessage); //consumer.MessageListener = ml; conn.Start(); Console.WriteLine("Consumer started"); }
private static IConnection CreateConnection() { // Create the connection factories factory var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Use the connection factories factory to create a connection factory var cf = factoryFactory.CreateConnectionFactory(); // Set the properties cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "localhost"); cf.SetIntProperty(XMSC.WMQ_PORT, 1415); cf.SetStringProperty(XMSC.WMQ_CHANNEL, "NewOne"); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "Test2"); var clientId = String.Format("NServiceBus-{0}", Thread.CurrentThread.ManagedThreadId); cf.SetStringProperty(XMSC.CLIENT_ID, clientId); var connection = cf.CreateConnection(); connection.Start(); return(connection); }
public IConnectionFactory GetConnectionFactory(int connectionType) { lock (connectionFactoryLock) { var factoryFactory = XMSFactoryFactory.GetInstance(connectionType); return(factoryFactory.CreateConnectionFactory()); } }
void ReceiveMessagesAsynchronous() { try { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); cf = factoryFactory.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, (String)properties[XMSC.WMQ_HOST_NAME]); cf.SetIntProperty(XMSC.WMQ_PORT, Convert.ToInt32(properties[XMSC.WMQ_PORT])); cf.SetStringProperty(XMSC.WMQ_CHANNEL, (String)properties[XMSC.WMQ_CHANNEL]); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, (String)properties[XMSC.WMQ_QUEUE_MANAGER]); connectionWMQ = cf.CreateConnection(); Console.WriteLine("-----------------------------------------------------"); Console.WriteLine("PERFORMANCE STATISTICS"); Console.WriteLine("-----------------------------------------------------"); using (sessionWMQ = connectionWMQ.CreateSession(true, AcknowledgeMode.AutoAcknowledge)) { var destination = sessionWMQ.CreateQueue((string)properties[XMSC.WMQ_QUEUE_NAME]); var consumerAsync = sessionWMQ.CreateConsumer(destination); var messageListener = new MessageListener(OnMessageCallback); consumerAsync.MessageListener = messageListener; Console.WriteLine("Summary:"); Console.WriteLine("-----------------------------------------------------"); Console.WriteLine("Registered Message Listener for 10k messages"); Console.WriteLine("Waiting to get statistics... "); Console.WriteLine("-----------------------------------------------------"); timer = new Stopwatch(); connectionWMQ.Start(); Console.ReadKey(); connectionWMQ.Stop(); // Cleanup consumerAsync.Close(); connectionWMQ.Close(); } } catch (XMSException ex) { Console.WriteLine("XMSException caught: {0}", ex); if (ex.LinkedException != null) { Console.WriteLine("Stack Trace:\n {0}", ex.LinkedException.StackTrace); } Console.WriteLine("Sample execution FAILED!"); } }
void SendMessage() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IMessageProducer producer; ITextMessage textMessage; Env.ConnVariables conn = env.Conn; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); // Set the properties ConnectionPropertyBuilder.SetConnectionProperties(cf, env); // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created"); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created"); // Create destination destination = sessionWMQ.CreateTopic(conn.topic_name); destination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ); Console.WriteLine("Destination created"); // Create producer producer = sessionWMQ.CreateProducer(destination); Console.WriteLine("Publisher created"); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Connection started"); // Create a text message and send it. textMessage = sessionWMQ.CreateTextMessage(); textMessage.Text = xmsJson.toJsonString(); producer.Send(textMessage); Console.WriteLine("Message published"); // Cleanup producer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
static void RegisterXMS(IServiceCollection services, IbmMQConfigModel configModel) { //Register ConnectionFactory var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var connectionFactory = factoryFactory.CreateConnectionFactory(); connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, configModel.Host); connectionFactory.SetIntProperty(XMSC.WMQ_PORT, configModel.Port); connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, configModel.Channel); connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, configModel.ManagerName); connectionFactory.SetStringProperty(XMSC.USERID, configModel.User); connectionFactory.SetStringProperty(XMSC.PASSWORD, configModel.Password); services.AddSingleton(connectionFactory); }
public ConnectionFactory(WebSphereMqSettings settings) { // Create the connection factories factory var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Use the connection factories factory to create a connection factory connectionFactory = factoryFactory.CreateConnectionFactory(); // Set the properties connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, settings.Hostname); connectionFactory.SetIntProperty(XMSC.WMQ_PORT, settings.Port); connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, settings.Channel); connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, settings.QueueManager); }
public IConnectionFactory CreateMQConnectionFactoryWMQ(String hostName, int portNumber, String channelName, String queueManagerName) { XMSFactoryFactory factory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); IConnectionFactory cf = factory.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, hostName); cf.SetIntProperty(XMSC.WMQ_PORT, portNumber); // For .NET only (Java JMS is okay using WMQ_CM_CLIENT): managed connections to WMQ (WMQ_CM_CLIENT) will not support SSL connections, but these might be supported by using an unmanaged connection (WMQ_CM_CLIENT_UNMANAGED). Refer to the WebSphere MQ Using .NET manual for accurate information. // WebSphere MQ configures a CHLAUTH record by default in WebSphere MQ Version 7.1 and later that blocks all MQ admins from connecting as a client to the queue manager. The following error in the MQ error logs would be seen for this scenario: // by default is XMSC.WMQ_CM_CLIENT; however, connection exception due to code 2035 cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); cf.SetStringProperty(XMSC.WMQ_CHANNEL, channelName); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, queueManagerName); return(cf); }
public static void SendMessageToQueue(QueueInfo queueInfo) { try { var xmsFactoryInstance = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var connectionFactory = xmsFactoryInstance.CreateConnectionFactory(); connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, queueInfo.HostName); connectionFactory.SetIntProperty(XMSC.WMQ_PORT, queueInfo.Port); connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, queueInfo.Channel); connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, queueInfo.NoManager); connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); var connection = connectionFactory.CreateConnection(); using (var connectionSession = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge)) { using (var destination = connectionSession.CreateQueue(queueInfo.QueueConnection)) { destination.SetIntProperty(XMSC.DELIVERY_MODE, MQConfigurationSettings.DELIVERY_MODE); destination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ); destination.SetBooleanProperty(XMSC.WMQ_MQMD_READ_ENABLED, true); destination.SetBooleanProperty(XMSC.WMQ_MQMD_WRITE_ENABLED, true); using (var producer = connectionSession.CreateProducer(destination)) { var textMessage = connectionSession.CreateTextMessage(queueInfo.Message); textMessage.SetIntProperty(XMSC.JMS_IBM_ENCODING, MQConfigurationSettings.JMS_IBM_ENCODING); textMessage.SetIntProperty(XMSC.JMS_IBM_CHARACTER_SET, MQConfigurationSettings.JMS_IBM_CHARACTER_SET); if (!string.IsNullOrEmpty(queueInfo.CorrelationId)) { textMessage.JMSCorrelationID = queueInfo.CorrelationId; } producer.Send(textMessage); producer.Close(); connectionSession.Close(); connectionSession.Dispose(); } } } } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } }
private static void RespondToCbc(string qMessage, string correlationId) { try { var xmsFactoryInstance = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var connectionFactory = xmsFactoryInstance.CreateConnectionFactory(); connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, MQConfigurationSettings.MNE_Equire_OUT_QConnection); connectionFactory.SetIntProperty(XMSC.WMQ_PORT, MQConfigurationSettings.MNE_Equire_OUT_PortNumber); connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, MQConfigurationSettings.MNE_Equire_OUT_QChannelName); connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, string.Empty); connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); //_connectionFactory.SetStringProperty(XMSC.WMQ_MESSAGE_BODY, XMSC.messa); var connection = connectionFactory.CreateConnection(); var connectionSession = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge); var destination = connectionSession.CreateQueue(string.Format("queue://{0}/{1}", string.Empty, MQConfigurationSettings.CBC_Declaration_OUT_QName)); destination.SetIntProperty(XMSC.DELIVERY_MODE, MQConfigurationSettings.DELIVERY_MODE); destination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ); destination.SetBooleanProperty(XMSC.WMQ_MQMD_READ_ENABLED, true); destination.SetBooleanProperty(XMSC.WMQ_MQMD_WRITE_ENABLED, true); var producer = connectionSession.CreateProducer(destination); var textMessage = connectionSession.CreateTextMessage(qMessage); textMessage.SetIntProperty(XMSC.JMS_IBM_ENCODING, MQConfigurationSettings.JMS_IBM_ENCODING); textMessage.SetIntProperty(XMSC.JMS_IBM_CHARACTER_SET, MQConfigurationSettings.JMS_IBM_CHARACTER_SET); textMessage.JMSCorrelationID = correlationId; producer.Send(textMessage); producer.Close(); producer.Dispose(); destination.Dispose(); connectionSession.Close(); connectionSession.Dispose(); } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } }
public ConnectionFactory(WebSphereMqSettings settings) { // Create the connection factories factory var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Use the connection factories factory to create a connection factory connectionFactory = factoryFactory.CreateConnectionFactory(); // Set the properties connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, settings.Hostname); connectionFactory.SetIntProperty(XMSC.WMQ_PORT, settings.Port); connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, settings.Channel); connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, settings.QueueManager); connectionFactory.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, settings.SslCipherSpec); connectionFactory.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, settings.SslKeyRepository); connectionFactory.SetStringProperty(XMSC.WMQ_SSL_PEER_NAME, settings.SslPeerName); }
/// <summary> /// Подключение к очереди /// </summary> public void Connect() { ThrowIfDisposed(); if (_isConnected) { return; } lock (ConnectionLock) { try { var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); _connectionFactory = factoryFactory.CreateConnectionFactory(); _connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, _configuration.Server); _connectionFactory.SetIntProperty(XMSC.WMQ_PORT, _configuration.Port); _connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, _configuration.Channel); _connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, _configuration.QueueManager); _connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_DEFAULT); _connection = string.IsNullOrEmpty(_configuration.User) ? _connectionFactory.CreateConnection() : _connectionFactory.CreateConnection(_configuration.User, _configuration.Password); _connection.ClientID = _configuration.ClientId; } catch (XMSException ex) { DisconnectInternal(); Logger.LogDebug("MQ connect failure:"); LogXmsException(ex); throw new MessagingException(ex, "Error while connect to the queue. See inner exception for more details"); } catch (Exception ex) { Logger.LogError(ex, "Error while connect to the queue. See inner exception for more details"); DisconnectInternal(); throw; } } _isConnected = true; }
private void ReceiveMessages() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); foreach (Env.ConnVariables e in env.GetEndpoints()) { Console.WriteLine("Consuming messages from endpoint {0}({1})", e.host, e.port); // Set the properties ConnectionPropertyBuilder.SetConnectionProperties(cf, e); try { ReceiveMessagesFromEndpoint(cf); } catch (XMSException ex) { Console.WriteLine("XMSException caught: {0}", ex); Console.WriteLine("Error Code: {0}", ex.ErrorCode); Console.WriteLine("Error Message: {0}", ex.Message); if (ex.LinkedException != null && IBM.XMS.MQC.MQRC_Q_MGR_NOT_AVAILABLE.ToString().Equals(ex.LinkedException.Message)) { Console.WriteLine("Queue Manager on this endpoint not available"); Console.WriteLine("Moving onto next endpoint"); continue; } Console.WriteLine("Unexpected Error - Aborting"); throw; } } }
/// <summary> /// Create a connection to the Queue Manager /// </summary> /// <returns></returns> private IConnection CreateConnection() { // Get an instance of factory. var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. var cf = factoryFactory.CreateConnectionFactory(); // Set the properties cf.SetStringProperty(XMSC.WMQ_HOST_NAME, (String)properties[XMSC.WMQ_HOST_NAME]); cf.SetIntProperty(XMSC.WMQ_PORT, Convert.ToInt32(properties[XMSC.WMQ_PORT])); cf.SetStringProperty(XMSC.WMQ_CHANNEL, (String)properties[XMSC.WMQ_CHANNEL]); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, (String)properties[XMSC.WMQ_QUEUE_MANAGER]); var shareCnv = Convert.ToBoolean(properties["ShareCnv"]); if (!shareCnv) { cf.SetIntProperty(XMSC.WMQ_SHARE_CONV_ALLOWED, XMSC.WMQ_SHARE_CONV_ALLOWED_NO); } return(cf.CreateConnection()); }
public DefaultIBMMQPersistentConnection(ILogger <DefaultIBMMQPersistentConnection> logger, IDictionary <string, string> config) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _topic = config["topic"]; // Get an instance of factory. var _factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. _connectionFactory = _factoryFactory.CreateConnectionFactory(); _connectionFactory.SetStringProperty(XMSC.USERID, config["userid"]); _connectionFactory.SetStringProperty(XMSC.PASSWORD, config["password"]); _connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, config["host"]); _connectionFactory.SetIntProperty(XMSC.WMQ_PORT, int.Parse(config["port"])); _connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, config["channel"]); _connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, config["qmgr"]); _connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); }
public void ListenMasterLocalFilesRequests() { _xffReadFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); _connectionFactory = _xffReadFactory.CreateConnectionFactory(); _connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, LMApplicationConfigurationdetails.RequestConnection); _connectionFactory.SetIntProperty(XMSC.WMQ_PORT, LMApplicationConfigurationdetails.RequestPort); _connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, LMApplicationConfigurationdetails.RequestChannel); _connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, LMApplicationConfigurationdetails.RequestManger); _connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); _connectionFactory.SetStringProperty(XMSC.WMQ_PROVIDER_VERSION, MQConfigurationSettings.WMQ_PROVIDER_VERSION); _mqConnection = _connectionFactory.CreateConnection(); _newSesstion = _mqConnection.CreateSession(false, AcknowledgeMode.AutoAcknowledge); _mqDestination = _newSesstion.CreateQueue(string.Format("queue://{0}/{1}", LMApplicationConfigurationdetails.RequestManger, LMApplicationConfigurationdetails.RequestQueueName)); _mqMessageConsumer = _newSesstion.CreateConsumer(_mqDestination); MessageListener ml = OnFilesReceived; _mqMessageConsumer.MessageListener = ml; _mqConnection.Start(); //Thread.Sleep(int.MaxValue); }
public void Setup() { XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); IConnectionFactory cf = xff.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "localhost"); cf.SetIntProperty(XMSC.WMQ_PORT, 1414); cf.SetStringProperty(XMSC.WMQ_CHANNEL, "CLIENT"); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "QM_LOCAL"); cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); IConnection conn = cf.CreateConnection(); Console.WriteLine("connection created"); ISession sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge); IDestination dest = sess.CreateQueue("queue://q"); IMessageConsumer consumer = sess.CreateConsumer(dest); MessageListener ml = new MessageListener(OnMessage); consumer.MessageListener = ml; conn.Start(); Console.WriteLine("Consumer started"); }
public void Setup() { XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); IConnectionFactory cf = xff.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, "10.87.188.156(7111)"); cf.SetIntProperty(XMSC.WMQ_PORT, 7111); cf.SetStringProperty(XMSC.WMQ_CHANNEL, "QMEIGS1.CRM.SVRCONN"); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "QMEIGS1"); cf.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); IConnection conn = cf.CreateConnection(); Console.WriteLine("connection created"); ISession sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge); IDestination dest = sess.CreateQueue("DOX.APYMT.ESB.SSK.RPO.02"); IMessageConsumer consumer = sess.CreateConsumer(dest); MessageListener ml = new MessageListener(OnMessage); consumer.MessageListener = ml; conn.Start(); Console.WriteLine("Consumer started"); }
void ReceiveMessages() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IMessageConsumer consumer; ITextMessage textMessage; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); // Set the properties cf.SetStringProperty(XMSC.WMQ_HOST_NAME, conn.host); Console.WriteLine("hostName is set {0, -20 }", conn.host); cf.SetIntProperty(XMSC.WMQ_PORT, conn.port); cf.SetStringProperty(XMSC.WMQ_CHANNEL, conn.channel); if (conn.key_repository != null && (conn.key_repository.Contains("*SYSTEM") || conn.key_repository.Contains("*USER"))) { cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); } else { cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); } // cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, conn.qmgr); cf.SetStringProperty(XMSC.USERID, conn.app_user); cf.SetStringProperty(XMSC.PASSWORD, conn.app_password); if (conn.key_repository != null && conn.cipher_suite != null) { cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, conn.key_repository); } if (conn.cipher_suite != null) { cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, conn.cipher_suite); } // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created"); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created"); // Create destination destination = sessionWMQ.CreateQueue(conn.queue_name); Console.WriteLine("Destination created"); // Create consumer consumer = sessionWMQ.CreateConsumer(destination); Console.WriteLine("Consumer created"); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Connection started"); Console.WriteLine("Receive message: " + TIMEOUTTIME / 1000 + " seconds wait time"); // Wait for 30 seconds for messages. Exit if no message by then while (SimpleResponse.keepRunning) { textMessage = (ITextMessage)consumer.Receive(TIMEOUTTIME); if (textMessage != null) { Console.WriteLine("Message received."); Console.Write(textMessage); Console.WriteLine("\n"); replyToMessage(textMessage, sessionWMQ); } else { Console.WriteLine("Wait timed out."); } } // Cleanup consumer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
void SendMessage() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IDestination temporaryDestination; IMessageProducer producer; ITextMessage textMessage; Env.ConnVariables conn = env.Conn; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); // Set the properties ConnectionPropertyBuilder.SetConnectionProperties(cf, env); cf.SetStringProperty(XMSC.WMQ_TEMPORARY_MODEL, conn.model_queue_name); // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created"); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created"); // Create destination destination = sessionWMQ.CreateQueue(conn.queue_name); destination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ); Console.WriteLine("Destination created"); // Create producer producer = sessionWMQ.CreateProducer(destination); Console.WriteLine("Producer created"); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Connection started"); // Create a text message and send it. textMessage = sessionWMQ.CreateTextMessage(); String corrID = xmsJson.correlationID; textMessage.Text = xmsJson.toJsonString(); //***disable for correl id by using message id textMessage.JMSCorrelationID = corrID; textMessage.JMSExpiration = 900000; temporaryDestination = sessionWMQ.CreateTemporaryQueue(); textMessage.JMSReplyTo = temporaryDestination; producer.Send(textMessage); Console.WriteLine("Message sent"); Console.WriteLine(textMessage.JMSCorrelationID); Console.WriteLine(corrID); String str = textMessage.JMSMessageID; String selector = "JMSCorrelationID='ID:" + JsonMessage.getCorrFilter(corrID) + "'"; Console.WriteLine(selector); IMessageConsumer consumer = sessionWMQ.CreateConsumer(temporaryDestination, selector); ITextMessage responseMessage = (ITextMessage)consumer.Receive(TIMEOUTTIME); if (responseMessage != null) { Console.WriteLine("Message received."); Console.Write(responseMessage); Console.WriteLine("\n"); } else { Console.WriteLine("Wait timed out."); } // Cleanup producer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
/// <summary> /// Method to connect to queue manager and receive messages. /// </summary> void ReceiveMessages() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IMessageConsumer consumer; ITextMessage textMessage; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); Console.WriteLine("Connection Factory created."); // Set the properties cf.SetStringProperty(XMSC.WMQ_HOST_NAME, hostName); cf.SetIntProperty(XMSC.WMQ_PORT, port); cf.SetStringProperty(XMSC.WMQ_CHANNEL, channelName); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, queueManagerName); if (sslKeyRepository != null) { cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, "sslKeyRepository"); } if (cipherSpec != null) { cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, cipherSpec); } if (sslPeerName != null) { cf.SetStringProperty(XMSC.WMQ_SSL_PEER_NAME, sslPeerName); } if (keyResetCount != -1) { cf.SetIntProperty(XMSC.WMQ_SSL_KEY_RESETCOUNT, keyResetCount); } if (sslCertRevocationCheck != false) { cf.SetBooleanProperty(XMSC.WMQ_SSL_CERT_REVOCATION_CHECK, true); } cf.SetStringProperty(XMSC.USERID, "bagmon"); cf.SetStringProperty(XMSC.PASSWORD, "Iceair123"); // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created."); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created."); // Create destination if (isTopic) { destination = sessionWMQ.CreateTopic(destinationName); } else { destination = sessionWMQ.CreateQueue(destinationName); } Console.WriteLine("Destination created."); // Create consumer consumer = sessionWMQ.CreateConsumer(destination); Console.WriteLine("Message Consumer created. Starting the connection now."); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Receive message: " + TIMEOUTTIME / 1000 + " seconds wait time"); // Wait for 30 seconds for messages. Exit if no message by then textMessage = (ITextMessage)consumer.Receive(TIMEOUTTIME); if (textMessage != null) { Console.WriteLine("Message received."); Console.Write(textMessage); Console.WriteLine("\n"); } else { Console.WriteLine("Wait timed out."); } // Cleanup consumer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
void SendMessage() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IDestination temporaryDestination; IMessageProducer producer; ITextMessage textMessage; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); // Set the properties cf.SetStringProperty(XMSC.WMQ_HOST_NAME, conn.host); Console.WriteLine("hostName is set {0, -20 }", conn.host); cf.SetIntProperty(XMSC.WMQ_PORT, conn.port); cf.SetStringProperty(XMSC.WMQ_CHANNEL, conn.channel); if (conn.key_repository != null && (conn.key_repository.Contains("*SYSTEM") || conn.key_repository.Contains("*USER"))) { cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); } else { cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); } cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, conn.qmgr); cf.SetStringProperty(XMSC.USERID, conn.app_user); cf.SetStringProperty(XMSC.PASSWORD, conn.app_password); cf.SetStringProperty(XMSC.WMQ_TEMPORARY_MODEL, conn.model_queue_name); if (conn.key_repository != null && conn.cipher_suite != null) { cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, conn.key_repository); } if (conn.cipher_suite != null) { cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, conn.cipher_suite); } // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created"); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created"); // Create destination destination = sessionWMQ.CreateQueue(conn.queue_name); destination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ); Console.WriteLine("Destination created"); // Create producer producer = sessionWMQ.CreateProducer(destination); Console.WriteLine("Producer created"); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Connection started"); // Create a text message and send it. textMessage = sessionWMQ.CreateTextMessage(); String corrID = xmsJson.correlationID; textMessage.Text = xmsJson.toJsonString(); //***disable for correl id by using message id textMessage.JMSCorrelationID = corrID; textMessage.JMSExpiration = 900000; temporaryDestination = sessionWMQ.CreateTemporaryQueue(); textMessage.JMSReplyTo = temporaryDestination; producer.Send(textMessage); Console.WriteLine("Message sent"); Console.WriteLine(textMessage.JMSCorrelationID); Console.WriteLine(corrID); String str = textMessage.JMSMessageID; String selector = "JMSCorrelationID='ID:" + JsonMessage.getCorrFilter(corrID) + "'"; Console.WriteLine(selector); IMessageConsumer consumer = sessionWMQ.CreateConsumer(temporaryDestination, selector); ITextMessage responseMessage = (ITextMessage)consumer.Receive(TIMEOUTTIME); if (responseMessage != null) { Console.WriteLine("Message received."); Console.Write(responseMessage); Console.WriteLine("\n"); } else { Console.WriteLine("Wait timed out."); } // Cleanup producer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
private void PublishMessageXMS() { // option 2: XMS // NOTE: in MQ, Topic --> Object Authorities --> Manage Authority Records --> Specific Profiles, make sure the users/groups (using the XMS API calls) have the proper permissions, eg. Publish, Subscribe and etc. XMSFactoryFactory ff = null; IConnectionFactory cf = null; IConnection conn = null; ISession sess = null; IDestination dest = null; IMessageProducer prod = null; ITextMessage tmsg = null; string topicName = txQName.Text.ToString(); try { ff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); cf = ff.CreateConnectionFactory(); cf.SetStringProperty(XMSC.WMQ_HOST_NAME, txHost.Text.ToString()); int portNo = 0; Int32.TryParse(txPort.Text.ToString(), out portNo); cf.SetIntProperty(XMSC.WMQ_PORT, portNo); cf.SetStringProperty(XMSC.WMQ_CHANNEL, txQChannel.Text.ToString()); cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); // default is XMSC.WMQ_CM_CLIENT, it is managed - using the same language; if need to access different platform, use unmanaged cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, txQMgr.Text.ToString()); /* * MessageBox.Show("Host:" + cf.GetStringProperty(XMSC.WMQ_HOST_NAME) + Environment.NewLine + * "Port:" + cf.GetIntProperty(XMSC.WMQ_PORT) + Environment.NewLine + * "Queue Manager:" + cf.GetStringProperty(XMSC.WMQ_QUEUE_MANAGER) + Environment.NewLine + * "Channel:" + cf.GetStringProperty(XMSC.WMQ_CHANNEL) + Environment.NewLine + * "Topic:" + topicName + Environment.NewLine); */ conn = cf.CreateConnection(); sess = conn.CreateSession(false, AcknowledgeMode.AutoAcknowledge); // MessageBox.Show("Session created."); dest = sess.CreateTopic(topicName); // dest.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, XMSC.WMQ_TARGET_DEST_MQ); // exclude RFH2 header since amqchange.exe cannot handle // MessageBox.Show("Destination created as Topic."); prod = sess.CreateProducer(dest); // MessageBox.Show("Message Producer created."); conn.Start(); // MessageBox.Show("Connection started."); tmsg = sess.CreateTextMessage(txMessage.Text.ToString()); prod.Send(tmsg); MessageBox.Show("Message " + tmsg.Text.Length + " sent to " + topicName); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException()); } finally { if (prod != null) { prod.Close(); } if (dest != null) { dest.Dispose(); } if (sess != null) { sess.Close(); sess.Dispose(); } if (conn != null) { conn.Close(); conn.Dispose(); } } }
void SendMessage() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IMessageProducer producer; ITextMessage textMessage; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); // Set the properties cf.SetStringProperty(XMSC.WMQ_HOST_NAME, conn.host); Console.WriteLine("hostName is set {0, -20 }", conn.host); cf.SetIntProperty(XMSC.WMQ_PORT, conn.port); cf.SetStringProperty(XMSC.WMQ_CHANNEL, conn.channel); if (conn.key_repository != null && (conn.key_repository.Contains("*SYSTEM") || conn.key_repository.Contains("*USER"))) { cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); } else { cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); } cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, conn.qmgr); cf.SetStringProperty(XMSC.USERID, conn.app_user); cf.SetStringProperty(XMSC.PASSWORD, conn.app_password); if (conn.key_repository != null && conn.cipher_suite != null) { cf.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, conn.key_repository); } if (conn.cipher_suite != null) { cf.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, conn.cipher_suite); } // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created"); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created"); // Create destination destination = sessionWMQ.CreateTopic(conn.topic_name); Console.WriteLine("Destination created"); // Create producer producer = sessionWMQ.CreateProducer(destination); Console.WriteLine("Publisher created"); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Connection started"); // Create a text message and send it. textMessage = sessionWMQ.CreateTextMessage(); textMessage.Text = xmsJson.toJsonString(); producer.Send(textMessage); Console.WriteLine("Message published"); // Cleanup producer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
void ReceiveMessages() { XMSFactoryFactory factoryFactory; IConnectionFactory cf; IConnection connectionWMQ; ISession sessionWMQ; IDestination destination; IMessageConsumer consumer; ITextMessage textMessage; Env.ConnVariables conn = env.Conn; // Get an instance of factory. factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); // Create WMQ Connection Factory. cf = factoryFactory.CreateConnectionFactory(); // Set the properties ConnectionPropertyBuilder.SetConnectionProperties(cf, env); // Create connection. connectionWMQ = cf.CreateConnection(); Console.WriteLine("Connection created"); // Create session sessionWMQ = connectionWMQ.CreateSession(false, AcknowledgeMode.AutoAcknowledge); Console.WriteLine("Session created"); // Create destination destination = sessionWMQ.CreateQueue(conn.queue_name); Console.WriteLine("Destination created"); // Create consumer consumer = sessionWMQ.CreateConsumer(destination); Console.WriteLine("Consumer created"); // Start the connection to receive messages. connectionWMQ.Start(); Console.WriteLine("Connection started"); Console.WriteLine("Receive message: " + TIMEOUTTIME / 1000 + " seconds wait time"); // Wait for 30 seconds for messages. Exit if no message by then while (SimpleResponse.keepRunning) { textMessage = (ITextMessage)consumer.Receive(TIMEOUTTIME); if (textMessage != null) { Console.WriteLine("Message received."); Console.Write(textMessage); Console.WriteLine("\n"); replyToMessage(textMessage, sessionWMQ); } else { Console.WriteLine("Wait timed out."); } } // Cleanup consumer.Close(); destination.Dispose(); sessionWMQ.Dispose(); connectionWMQ.Close(); }
public static void Main(string[] args) { var env = MqEnvironment.Load("env.json"); if (args.Length == 0) { Console.WriteLine("Say which program you want to run; put, get, pub, sub, request, response"); Environment.Exit(0); } var xmsFactoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var connectionFactory = xmsFactoryFactory.CreateConnectionFactory(); connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, env.Host); connectionFactory.SetIntProperty(XMSC.WMQ_PORT, env.Port); connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, env.Channel); connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, env.Qmgr); if (env.KeyRepository != null && env.CipherSuite != null) { connectionFactory.SetStringProperty(XMSC.WMQ_SSL_KEY_REPOSITORY, env.KeyRepository); } if (env.CipherSuite != null) { connectionFactory.SetStringProperty(XMSC.WMQ_SSL_CIPHER_SPEC, env.CipherSuite); } //connectionFactory.SetStringProperty(XMSC.USERID, env.AppUser); //connectionFactory.SetStringProperty(XMSC.PASSWORD, env.AppPassword); try { switch (args[0]) { case "put": new SimpleProducer(connectionFactory, env).PutMessage(); break; case "get": new SimpleConsumer(connectionFactory, env, CancellationTokenSource.Token).GetMessages(); break; case "sub": new SimpleSubscriber(connectionFactory, env, CancellationTokenSource.Token).SubscribeMessages(); break; case "pub": new SimplePublisher(connectionFactory, env).PublishMessage(); break; case "request": connectionFactory.SetStringProperty(XMSC.WMQ_TEMPORARY_MODEL, env.ModelQueueName); new SimpleRequest(connectionFactory, env, CancellationTokenSource.Token).SendRequest(); break; case "response": new SimpleResponse(connectionFactory, env, CancellationTokenSource.Token).ReceiveMessages(); break; default: Console.WriteLine("Say which program you want to run; put, get, pub, sub, request, response"); break; } } catch (XMSException ex) { Console.WriteLine(ex); } }