MessageIn Event

Fires when the component receives a message.

Syntax

public event OnMessageInHandler OnMessageIn;

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

public class AmqpMessageInEventArgs : EventArgs {
  public string SessionName { get; }
  public int SessionIndex { get; }
  public string LinkName { get; }
  public int LinkIndex { get; }
  public string MessageId { get; }
  public int State { get; set; }
}
Public Event OnMessageIn As OnMessageInHandler

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

Public Class AmqpMessageInEventArgs Inherits EventArgs
  Public ReadOnly Property SessionName As String
  Public ReadOnly Property SessionIndex As Integer
  Public ReadOnly Property LinkName As String
  Public ReadOnly Property LinkIndex As Integer
  Public ReadOnly Property MessageId As String
  Public Property State As Integer
End Class

Remarks

This event fires whenever the component receives a message. The message itself is automatically stored as an AMQPMessage object in the ReceivedMessage property.

Specifying a Delivery Outcome

The State parameter can be set to one of the following values to specify what delivery outcome the component should report to the sender (the default is Accepted (0)):
  • 0: Accepted - The message has been processed successfully.
  • 1: Rejected - The message failed to process successfully. Includes an error describing why.
  • 2: Released - The message has not been (and will not be) processed.
  • 3: Modified - Same as "Released", but with additional metadata for the sender.

When State is set to Rejected (1), the component will include error metadata when it informs the sender of the outcome. Set the RejectErrorCondition and RejectErrorDescription configuration settings before the event handler finishes to specify this error information.

When State is set to Modified (3), the component can include additional metadata when it informs the sender of the outcome. Set zero or more of the ModifiedDeliveryFailed, ModifiedMessageAnnotations, and ModifiedUndeliverableHere configuration settings before the event handler finishes to specify this additional metadata.

Other Parameters

SessionName is the name of the session the message was transmitted on.

SessionIndex is the index of the session in the Sessions collection property.

LinkName is the name of the link the message was transmitted on.

LinkIndex is the index of the link in the Links collection property.

MessageId is the Id of the message; it may be empty if a message Id was not set.

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