Exemplo n.º 1
0
 public bool routeMessage(string serviceCategory, string serviceName, msmqInMessage message) {
     object[] results = this.Invoke("routeMessage", new object[] {
                 serviceCategory,
                 serviceName,
                 message});
     return ((bool)(results[0]));
 }
Exemplo n.º 2
0
        public void testbutton_Click(object sender, EventArgs e)
        {
            MessageQueue mq;
            string queueName = Properties.Settings.Default.MessageQueueName;
            if (MessageQueue.Exists(queueName))
            {
                mq = new MessageQueue(queueName);
            }
            else
            {
                mq = MessageQueue.Create(queueName, true);
            }

            gateway = new MsmqInGatewayWSService();

            MessageQueueTransaction transaction = new MessageQueueTransaction();
            //while (running)
               // {
                try
                {
                    transaction.Begin();
                    System.Messaging.Message message = mq.Receive(new TimeSpan(0, 0, 1), transaction);

                    Console.WriteLine("Message received");

                    msmqInMessage msmqMsg = new msmqInMessage();
                    msmqMsg.label = message.Label;
                    Console.WriteLine("Message received333");
                    msmqMsg.id = message.Id;
                    Console.WriteLine("Message received222");
                    msmqMsg.body = readFully(message.BodyStream);

                    Console.WriteLine("Commit");
                    transaction.Commit();

                    messageList.Items.Add(msmqMsg.label);
                    messageQueues.Add(msmqMsg.id, msmqMsg);
                }
                catch (MessageQueueException mqe)
                {
                    if (mqe.MessageQueueErrorCode != MessageQueueErrorCode.IOTimeout)
                        Console.WriteLine("MessageQueue failure: " + mqe.Message);
                }
                finally
                {
                    if (transaction.Status == MessageQueueTransactionStatus.Pending)
                    {
                        transaction.Abort();
                    }
                }
               // }
        }
Exemplo n.º 3
0
 /// <remarks/>
 public void routeMessageAsync(string serviceCategory, string serviceName, msmqInMessage message, object userState) {
     if ((this.routeMessageOperationCompleted == null)) {
         this.routeMessageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnrouteMessageOperationCompleted);
     }
     this.InvokeAsync("routeMessage", new object[] {
                 serviceCategory,
                 serviceName,
                 message}, this.routeMessageOperationCompleted, userState);
 }
Exemplo n.º 4
0
 /// <remarks/>
 public void routeMessageAsync(string serviceCategory, string serviceName, msmqInMessage message) {
     this.routeMessageAsync(serviceCategory, serviceName, message, null);
 }