Exemple #1
0
 /// <summary>
 /// This event handler is invoked by Solace Systems Messaging API when a message arrives
 /// </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 private void HandleMessageEvent(object source, MessageEventArgs args)
 {
     // Received a message
     Console.WriteLine("Received message.");
     using (IMessage message = args.Message)
     {
         // Expecting the message content as a binary attachment
         Console.WriteLine("Message content: {0}", Encoding.ASCII.GetString(message.BinaryAttachment));
         // ACK the message
         Flow.Ack(message.ADMessageId);
         CountdownEvent.Signal();
     }
 }
        /// <summary>
        /// Demonstrates message acknoweldgment of received messages over the Flow.
        /// ClientAck on the Flow is enabled by setting flowProps.AckMode to MessageAckMode.ClientAck.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="args"></param>
        internal void HandleMessageAndAck(Object source, MessageEventArgs args)
        {
            // Print the message.
            SampleUtils.PrintMessageEvent(source, args);

            // Acknowledge incoming message after it has been processed.
            if (flow != null)
            {
                flow.Ack(args.Message.ADMessageId);
            }

            // It is recommended to dispose the message after processing it.
            args.Message.Dispose();
        }
Exemple #3
0
        private void HandleMessage(object source, MessageEventArgs args)
        {
            ProcessMessageNumber++;

            log.Trace(() => $"Received Message from Solace - {ProcessMessageNumber}");

            // Received a message
            IMessage solMsg = args.Message;

            var messageId = args.Message.ADMessageId;



            SolaceMessage <TContent> msg = new SolaceMessage <TContent>(args.Message, serializer, () => flow.Ack(messageId), () => { });
            var qItem = new MessagedReceivedArguments <TContent> {
                Message = msg, ReceivedTimestamp = DateTimeOffset.Now, ProcessMessageNumber = ProcessMessageNumber
            };

            incomingMessages.Enqueue(qItem);

            waitHandle.Set();
        }