public void SqsAckFlow_default_stream_should_react_on_ChangeVisibility_commands() { client.ChangeMessageVisibilityAsync(Arg.Any <ChangeMessageVisibilityRequest>()).Returns( Task.FromResult(new ChangeMessageVisibilityResponse())); var publisher = this.CreatePublisherProbe <MessageAction>(); var subscriber = this.CreateSubscriberProbe <ISqsAckResult>(); Source.FromPublisher(publisher) .Via(SqsAckFlow.Default(client, TestQueueUrl, SqsAckSettings.Default.WithMaxInFlight(1))) .To(Sink.FromSubscriber(subscriber)) .Run(materializer); subscriber.Request(3); publisher.SendNext(MessageAction.ChangeVisibility(Message("a-1"), 10.Seconds())); publisher.SendNext(MessageAction.ChangeVisibility(Message("a-2"), 13.Seconds())); subscriber.ExpectNext <ISqsAckResult>(ack => ack is SqsChangeMessageVisibilityResult r && r.Action.Message.ReceiptHandle == "a-1" && r.Action.VisibilityTimeout == 10.Seconds()); subscriber.ExpectNext <ISqsAckResult>(ack => ack is SqsChangeMessageVisibilityResult r && r.Action.Message.ReceiptHandle == "a-2" && r.Action.VisibilityTimeout == 13.Seconds()); subscriber.Cancel(); }
public void SqsAckFlow_default_stream_should_react_on_Ignore_commands() { var publisher = this.CreatePublisherProbe <MessageAction>(); var subscriber = this.CreateSubscriberProbe <ISqsAckResult>(); Source.FromPublisher(publisher) .Via(SqsAckFlow.Default(client, TestQueueUrl, SqsAckSettings.Default.WithMaxInFlight(1))) .To(Sink.FromSubscriber(subscriber)) .Run(materializer); subscriber.Request(3); publisher.SendNext(MessageAction.Ignore(Message("a-1"))); publisher.SendNext(MessageAction.Ignore(Message("a-2"))); subscriber.ExpectNext <ISqsAckResult>(ack => ack is SqsIgnoreResult r && r.Action.Message.ReceiptHandle == "a-1"); subscriber.ExpectNext <ISqsAckResult>(ack => ack is SqsIgnoreResult r && r.Action.Message.ReceiptHandle == "a-2"); subscriber.Cancel(); }