postgresql-to-amqp icon indicating copy to clipboard operation
postgresql-to-amqp copied to clipboard

A few ideas (if you want to consider)

Open ruslantalpa opened this issue 7 years ago • 1 comments

I see this as a "bridge" between the two components, so with this idea in mind, why not have the convention that the PG channel is equal to the RMQ entity, where entity is either an exchange or a queue. This is also probably the way users will want to set up things anyway, in order to make it obvious where the PG event will end up in RabbitMQ.

I am not sure if this component should take on the creation of the queue/exchange since this will complicate the code and the config interface, maybe it should just error out (or try to reconnect again) if the entity is not yet created in Rabbit.

Another idea to consider is that you probably want to be able to bridge multiple channels at the same time (each handled by a separate thread)

With this ideas/features in place, the config interface is very simple yet very flexible/powerful

docker run --rm -it \
-e POSTGRESQL_URI=postgresql://username:[email protected]:port/database \
-e AMQP_HOST_PORT=127.0.0.1:5672 \
-e BRIDGE_CHANNELS="foo:queue,bar:exchange" \
fgribreau/postgresql-to-amqp

What do you think?

ruslantalpa avatar Apr 09 '17 18:04 ruslantalpa

where entity is either an exchange or a queue

I would like to definitely enforce an exchange, everytime so it creates a layer of indirection and helps for debugging or extension

I am not sure if this component should take on the creation of the queue/exchange since this will complicate the code and the config interface, maybe it should just error out (or try to reconnect again) if the entity is not yet created in Rabbit.

In theory I think every app should create their own exchanges/queues on the broker and they should be removed when no one is publishing/listening on them anymore BUT for the v1 I won't go into that path and let the dev(ops) configure it manually :) so :+1:

Another idea to consider is that you probably want to be able to bridge multiple channels at the same time (each handled by a separate thread)

I will prefer to have an instance of the app per channel instead of letting the app handle it itself, since postgresql-to-amqp is so lightweight we can definitely do this (and it will keep the code easy, not complex reconnection feature), the only issue I see will be that it will grow the number of active connection to both PG and the AMQP broker but it's not that big of an issue.

With this ideas/features in place, the config interface is very simple yet very flexible/powerful

docker run --rm -it \
-e POSTGRESQL_URI=postgresql://username:[email protected]:port/database \
-e AMQP_HOST_PORT=127.0.0.1:5672 \
-e BRIDGE_CHANNELS="foo:queue,bar:exchange" \
fgribreau/postgresql-to-amqp

I would like to change it to something like:

docker run --rm -it \
-e POSTGRESQL_URI=postgresql://username:[email protected]:port/database \
-e POSTGRESQL_CHANNEL="foo" \
-e AMQP_URI=amqp://username:[email protected]:port/vhost \
-e AMQP_EXCHANGE=bar \
fgribreau/postgresql-to-amqp

FGRibreau avatar Apr 10 '17 08:04 FGRibreau