simplesourcing / simplesagas

Simple Sagas is a library for building process coordinators for distributed systems based on Kafka Streams
Apache License 2.0
20 stars 5 forks source link

Test coverage - async action processor #17

Closed szoio closed 5 years ago

szoio commented 5 years ago

Add test coverage for the async action processor.

wongelz commented 5 years ago

I started looking into this. We may have to convert the Kafka consumer code to a Processor so that it is part of the Topology.

szoio commented 5 years ago

I agree. If it forms part of the topology it will be easier to test. That's probably the right way to do it in any case.

wongelz commented 5 years ago

Currently a dead-end :( https://issues.apache.org/jira/browse/KAFKA-6989

Basically what happens is when the "process" method returns, the "current node" is removed from the context, and you can no longer use it to "forward" messages. So when the async action completes on a new thread, the context is in that state with no current node, and forwarding fails.

szoio commented 5 years ago

That's too bad. What we have currently does work, but it steps outside the Kafka Streams world, so it's a) not that easy to test with the TopologyTestDriver and b) cannot offer the same consistency guarantee, though it might be sufficiently robust for pretty much any real application, provided the action itself is idempotent. It may be possible to partially test with the TopologyTestDriver.