private static void RespondToMneEnquire(string qMessage, string correlationId) { var queueInfo = new QueueInfo { Manager = MNEApplicationConfigurationdetails.ResponseManger, Channel = MNEApplicationConfigurationdetails.ResponseChannel, UseManagerName = false, Port = MNEApplicationConfigurationdetails.ResponsePort, HostName = MNEApplicationConfigurationdetails.ResponseHostName, QueueName = MNEApplicationConfigurationdetails.ResponseQueueName, CorrelationId = correlationId, Message = qMessage }; FdrMessaging.SendMessageToQueue(queueInfo); try { var message = Sars.Systems.Serialization.XmlObjectSerializer.GetXmlWithNoDeclaration(qMessage); DbWriter.SaveMneResponse(correlationId, message); } catch (Exception) { ; } }
private static void RespondToDocumentNotify(string qMessage, string messageId) { try { var queueInfo = new QueueInfo { Manager = LMApplicationConfigurationdetails.ResponseManger, Channel = LMApplicationConfigurationdetails.ResponseChannel, UseManagerName = false, Port = LMApplicationConfigurationdetails.ResponsePort, HostName = LMApplicationConfigurationdetails.ResponseHostName, QueueName = LMApplicationConfigurationdetails.ResponseQueueName, CorrelationId = messageId, Message = qMessage }; FdrMessaging.SendMessageToQueue(queueInfo); try { FdrCommon.SaveMessage(qMessage, @"\\ptadviis06\TaxDirectives\FDR\FILES\OUT"); } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } }
private static void OnMessage(IMessage msg) { //var corId = FdrCommon.ByteArrayToString(msg.JMSCorrelationIDAsBytes); var message = string.Empty; try{ var textMsg = (ITextMessage)msg; message = textMsg.Text; try{ message = FdrCommon.FormatXml(message); } catch (Exception) { ; } var dataValidation = IsCbcValid(message); var header = FdrCommon.SelectNode(message, "soap12", "http://www.w3.org/2003/05/soap-envelope", "Header"); if (header != null) { var messageToSend = dataValidation.IsValid ? CreateXml(header.OuterXml) : FdrCommon.CreateFaultXml(header.OuterXml, dataValidation.ErrorXml); var queueInfo = new QueueInfo { Manager = CBCApplicationConfigurationdetails.ResponseManger, Channel = CBCApplicationConfigurationdetails.ResponseChannel, UseManagerName = false, Port = CBCApplicationConfigurationdetails.ResponsePort, HostName = CBCApplicationConfigurationdetails.ResponseHostName, QueueName = CBCApplicationConfigurationdetails.ResponseQueueName, CorrelationId = msg.JMSMessageID, Message = messageToSend }; FdrMessaging.SendMessageToQueue(queueInfo); if (!dataValidation.IsValid) { return; } } } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } try{ if (!string.IsNullOrEmpty(message)) { SaveIncomingCbcDeclaration(message); } } catch (Exception exception) { FdrCommon.LogEvent(exception, EventLogEntryType.Error); } }
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); } }