Beispiel #1
0
            /// <summary>
            /// Used to reject (to not acknowledge) this message.
            /// Indicates that the message can not received correctly or can not handled the message, and the message
            /// must be sent to client application later again.
            /// If MDS server gets reject for a message,
            /// it doesn't send any message to the client application instance for a while.
            /// If message is persistent, than it is sent to another instance of application or to same application instance again.
            /// If message is not persistent, it is deleted.
            /// </summary>
            /// <param name="reason">Reject reason</param>
            public void Reject(string reason)
            {
                if (AckState == MessageAckStates.Rejected)
                {
                    return;
                }

                if (AckState == MessageAckStates.Acknowledged)
                {
                    throw new MDSException("Message is acknowledged before.");
                }

                _client.SendMessageInternal(
                    new MDSOperationResultMessage
                {
                    RepliedMessageId = MessageId,
                    Success          = false,
                    ResultText       = reason
                });

                AckState = MessageAckStates.Rejected;
            }
Beispiel #2
0
            /// <summary>
            /// Used to Acknowledge this message.
            /// Confirms that the message is received safely by client application.
            /// A message must be acknowledged by client application to remove message from message queue.
            /// MDS server doesn't send next message to the client application until the message is acknowledged.
            /// Also, MDS server sends same message again if the message is not acknowledged in a certain time.
            /// </summary>
            public void Acknowledge()
            {
                if (AckState == MessageAckStates.Acknowledged)
                {
                    return;
                }

                if (AckState == MessageAckStates.Rejected)
                {
                    throw new MDSException("Message is rejected before.");
                }

                _client.LastAcknowledgedMessageId = MessageId;

                _client.SendMessageInternal(
                    new MDSOperationResultMessage
                {
                    RepliedMessageId = MessageId,
                    Success          = true
                });

                AckState = MessageAckStates.Acknowledged;
            }
Beispiel #3
0
            /// <summary>
            /// Used to reject (to not acknowledge) this message.
            /// Indicates that the message can not received correctly or can not handled the message, and the message 
            /// must be sent to client application later again.
            /// If NGRID server gets reject for a message,
            /// it doesn't send any message to the client application instance for a while.
            /// If message is persistent, than it is sent to another instance of application or to same application instance again. 
            /// If message is not persistent, it is deleted.
            /// </summary>
            /// <param name="reason">Reject reason</param>
            public void Reject(string reason)
            {
                if (AckState == MessageAckStates.Rejected)
                {
                    return;
                }

                if (AckState == MessageAckStates.Acknowledged)
                {
                    throw new NGRIDException("Message is acknowledged before.");
                }

                _client.SendMessageInternal(
                    new NGRIDOperationResultMessage
                    {
                        RepliedMessageId = MessageId,
                        Success = false,
                        ResultText = reason
                    });

                AckState = MessageAckStates.Rejected;
            }
Beispiel #4
0
            /// <summary>
            /// Used to Acknowledge this message.
            /// Confirms that the message is received safely by client application.
            /// A message must be acknowledged by client application to remove message from message queue.
            /// NGRID server doesn't send next message to the client application until the message is acknowledged.
            /// Also, NGRID server sends same message again if the message is not acknowledged in a certain time.
            /// </summary>
            public void Acknowledge()
            {
                if (AckState == MessageAckStates.Acknowledged)
                {
                    return;
                }
                
                if (AckState == MessageAckStates.Rejected)
                {
                    throw new NGRIDException("Message is rejected before.");
                }

                _client.LastAcknowledgedMessageId = MessageId;

                _client.SendMessageInternal(
                    new NGRIDOperationResultMessage
                    {
                        RepliedMessageId = MessageId,
                        Success = true
                    });

                AckState = MessageAckStates.Acknowledged;
            }