jeroenrinzema / commander

Build event-driven and event streaming applications with ease
MIT License
66 stars 5 forks source link

Streaming between dialects #11

Closed jeroenrinzema closed 5 years ago

jeroenrinzema commented 5 years ago

Businesses have a lot of times multiple pieces of infrastructure which requires integrations to be made. Streaming between dialects could allow two totally different dialects to stream from one another (ex: Redis - Kafka, Kafka - RabbitMQ).

This requires the consume, handle and writer interfaces to be modified. The API should feel natural and not in the way. An idea is to move the consuming and writing from the groups to the dialect.

dialect.Handle(commander.EventTopic, "action", func())

and the writer to include the dialect.

writer.ProduceEvent(dialect, "action", 1, uuid.UUID, nil)
jeroenrinzema commented 5 years ago

Rewriting the way how groups and dialects are defined could probably open new ways to define streaming between dialects.

dialect := kafka.NewDialect("...connectionstring")

bank := commander.NewGroup(
  commander.NewTopic("events", dialect, commander.EventMessage, commander.Consume),
  commander.NewTopic("commands", dialect, commander.CommandMessage, commander.Consume | commander.Produce)
)

client := commander.NewClient(bank)