public Task SettleMessage(IWorkContext context, long messageId, int agentId, SettleType settleType, string errorMessage = null) { return(new SqlExec(_configuration.SqlConfiguration) .SetCommand("[App].[Settle-Message]") .AddParameter(nameof(messageId), messageId) .AddParameter(nameof(agentId), agentId) .AddParameter(nameof(settleType), settleType.ToString()) .AddParameter(nameof(errorMessage), errorMessage) .ExecuteNonQuery(context)); }
/// <summary> /// Settle message for Dequeue and lock operations /// </summary> /// <param name="context">context</param> /// <param name="messageId">message id</param> /// <param name="settleType">settle type</param> /// <param name="errorMessage">error message (optional)</param> /// <returns>task</returns> private async Task SettleMessage(IWorkContext context, long messageId, SettleType settleType, string errorMessage = null) { AgentContractV1 agent = await GetAgent(context); var settleMessage = new SettleMessageContractV1 { AgentId = agent.AgentId, QueueName = QueueName, SettleType = settleType, MessageId = messageId, ErrorMessage = errorMessage }; await Client.Message.SettleMessage(context, settleMessage); }
public void VerifyHistoryMessage( MessageContractV1 readMessage, HistoryContractV1 history, string queueName, string agentName, int retryCount = 1, SettleType settleType = SettleType.Processed ) { history.Should().NotBeNull(); history.HistoryId.Should().BeGreaterOrEqualTo(0); history.MessageId.Should().Be(readMessage.MessageId); history.ActivityType.Should().Be(settleType.ToString()); history.QueueName.Should().Be(queueName); history.Cv.Should().Be(readMessage.Cv); history.ClientMessageId.Should().Be(readMessage.ClientMessageId); history.Payload.Should().Be(readMessage.Payload); history.SettleByAgent.Should().Be(agentName); history.ErrorMesage.Should().BeNullOrEmpty(); history.RetryCount.Should().Be(retryCount); }
public Task SettleMessage(IWorkContext context, long messageId, int agentId, SettleType settleType, string errorMessage = null) { return(_message.SettleMessage(context, messageId, agentId, settleType, errorMessage)); }
/// <summary> /// Settle a message based on message event /// </summary> /// <param name="context">context</param> /// <param name="messageEvent">message event</param> /// <param name="settleType">settle type</param> /// <param name="errorMessage">error message (optional)</param> /// <returns></returns> public async Task Settle(IWorkContext context, MessageEvent <T> messageEvent, SettleType settleType, string errorMessage = null) { Verify.IsNotNull(nameof(messageEvent), messageEvent); Verify.Assert(messageEvent.UseSettle, "Message did not require settlement"); await SettleMessage(context, messageEvent.Contract.MessageId, settleType, errorMessage); }
/// <summary> /// Settle a message /// </summary> /// <param name="context">context</param> /// <param name="messageId">message id</param> /// <param name="settleType">settle type</param> /// <param name="errorMessage">error message</param> /// <returns>task</returns> public async Task Settle(IWorkContext context, long messageId, SettleType settleType, string errorMessage = null) { await SettleMessage(context, messageId, settleType, errorMessage); }