MessageIn Event

Fired when a message has been received.

Syntax

public event OnMessageInHandler OnMessageIn;

public delegate void OnMessageInHandler(object sender, StompMessageInEventArgs e);

public class StompMessageInEventArgs : EventArgs {
  public string MessageId { get; }
  public string SubscriptionId { get; }
  public string Destination { get; }
  public string Data { get; }
public byte[] DataB { get; } public string ContentType { get; } public bool Ack { get; set; } }
Public Event OnMessageIn As OnMessageInHandler

Public Delegate Sub OnMessageInHandler(sender As Object, e As StompMessageInEventArgs)

Public Class StompMessageInEventArgs Inherits EventArgs
  Public ReadOnly Property MessageId As String
  Public ReadOnly Property SubscriptionId As String
  Public ReadOnly Property Destination As String
  Public ReadOnly Property Data As String
Public ReadOnly Property DataB As Byte() Public ReadOnly Property ContentType As String Public Property Ack As Boolean End Class

Remarks

This events fires whenever the component has received a message.

In addition to the message details exposed by the event parameters, the ParsedHeaders collection property is populated with the headers parsed from the message. When the MessageIn event handler exits, the parsed headers are cleared. The following parameters are available within this event:

  • MessageId: The unique Id of the message.
  • SubscriptionId: The subscription Id the message is associated with.
  • Destination: The message destination on the server which the message originated from.
  • Data: The message's payload.
  • ContentType: The content type of the message (may be empty).
  • Ack: Set to True or False to control whether the component should send back a positive (True, default) or negative (False) message acknowledgment.

Message acknowledgments are only sent back to the server for messages which require them. A positive acknowledgment indicates that the message has been accepted, while a negative acknowledgment represents that the message has been rejected.

The following two configuration settings are also relevant in the context of sending back message acknowledgments for incoming messages:

  • The AckTransactionId configuration setting, if not empty, specifies a transaction Id to associate the message acknowledgment with. It can only be set during the MessageIn event handler, and will be reset when the event handler ends.
  • The RequestAckReceipts configuration setting controls whether the component will request that the server confirm receipt of the message acknowledgment. It is False by default, and can be set at any time.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 .NET Edition - Version 20.0 [Build 8155]