These are chat archives for akkadotnet/AkkaStreams

Jun 2017
Sean Farrow
Jun 02 2017 17:14


I havwe the following code:
var val = TestSource.SourceProbe<string>(this).Via(SnsPublisher.PublishToSNSFlow("topic-Arn", snsService)).ToMaterialized(Sink.Seq<PublishResponse>(), Keep.Both).Run(this.materializer);
var task =val.Item2.Wait(TimeSpan.FromSeconds(1)).Should().BeTrue();
the flow takes a string and an IAmazonSnsClient and returns a PublishResponse and is defined as:
public static Flow<string, PublishResponse, NotUsed> PublishToSNSFlow(string topicArn, IAmazonSimpleNotificationService snsService)
return Flow.FromGraph(new SNSPublishFlowStage(topicArn, snsService));
A couple of questions:
Firstly, how come I have to specify the type that Seq need? it can't seem to infer that on it's own.
Secondly the scala code is:
Await.result(future, 1.second) mustBe publishResult :: Nil
what is this testing, there is not publish result in the c# code.
help apreciated as always.

Marc Piechura
Jun 02 2017 17:26
You always need to specify the Type for the Sink. methods
val.Item2.Result should be the publishedRespone
And you don't need to add null to it, that was a mistake on my github response
publishedResponse :: nil afaik compiles to something like ImmutableList.Empty.AddRange(publishedResponse)
Sean Farrow
Jun 02 2017 17:32
Okay thanks, that makes sense! I'll test to see if the published result I expect comes back from the task I have no idea what they were doing though? Testing for no it doesn't seem to make sense but never mind
Marc Piechura
Jun 02 2017 17:37
Test looks quite strait forward to me, you're testing if your PublishToSNSFlow handles the string elements correctly by providing a single string element and expecting a single PublishResponse
Sean Farrow
Jun 02 2017 17:40
Okay I'll finish Portee and open a PO for you to have a look
Marc Piechura
Jun 02 2017 17:45
Sounds good, could you please also put a link to the scala version in the PR ?