eventuate-tram / eventuate-tram-core

Transactional messaging for microservices
Other
1.03k stars 185 forks source link

Rethink transactional.noop.duplicate.message.detector.factory.enabled #97

Open cer opened 4 years ago

cer commented 4 years ago

This seems pretty ugly: https://github.com/eventuate-tram/eventuate-tram-docs/blob/master/src/docs/asciidoc/getting-started-eventuate-tram.adoc#micronaut-3

I understand that Micronaut searches the classpath for beans/factories - no @Import

This is the fallback NoopDuplicateMessageDetector and is only defined if there is no other bean. The developer can use it by not adding eventuate-tram-micronaut-consumer-jdbc as a dependency.

If the developer wants either of these:

Then they have add eventuate-tram-micronaut-consumer-jdbc as a dependency.

It seems ugly to have a boolean flag. What would be cleaner would be a property like transactional.duplicate.detector.factory:

Does @Requires support Unset orsqlTable` - time to read the manual?

cer commented 4 years ago

NoopDuplicateMessageDetector should not be the default - it's too dangerous.

dartartem commented 4 years ago

Chris,

I checked the micronaut docs. It seems we can use

@Requires(property="transactional.duplicate.detector.factory", value="sqlTable", default="sqlTable")

For SqlTableBasedDuplicateMessageDetector bean

and:

@Requires(property="transactional.duplicate.detector.factory", value="noop")

for TransactionalNoopDuplicateMessageDetector

Please let me know if I can start working on it.