Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the ability to have the type in the routing key for rabbitmq prod… #1394

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

paulhoang-hee
Copy link

…ucer

This is rather a cheeky PR, its a small tweak to an existing feature for the RabbitMQ routing keys.

It would be really helpful for our team to have the ability to include the type of message in the routing key as we route our messages in the format [system].[entity(table)].[event(type)].

@osheroff
Copy link
Collaborator

i'm fine with this. chance you could refactor the rabbitmq and kafka/kinesis producer to use common code for interpolation here so that everyone can bask in the glory of your cheeky feature?

@paulhoang-hee
Copy link
Author

haha, thanks for getting back so soon! sure i'll see if i can make the same changes for the kafka/kinesis producers

@paulhoang-hee
Copy link
Author

Hi @osheroff, I've done another commit, this includes the Kafka topic change but I couldn't find anything relating to the topics for Kenisis.

You've not asked for it but I've also made the change to the Redis producer to do the same.

@osheroff
Copy link
Collaborator

osheroff commented Dec 1, 2019

ah @paulhoang-hee, sorry, I was not specific enough. Can you make it so that the kafka and the redis producer actually share code to do the interpolation? thx!

…nt. Gives a default implementation so that procuders can builder topic/channel(destination) strings
@paulhoang-hee
Copy link
Author

Hi @osheroff, no need to apologise. I've pushed another commit so that the Redis and Kafka producers share the same code. I was initially going to pull up the method into the Abstract class but then that would affect the 5+ or so other classes that extend it. I then thought about moving it to a utils class but that felt wrong as it would just be a single class with no other methods.

So I ended up created an interface with a default method. If this doesn't make sense please let me know. I also found it hard naming it so if you want that changed too, please let me know (naming things is hard)

@osheroff
Copy link
Collaborator

why not just an instance method on RowMap? Maybe not exactly the correct place to put it but probably good enough.

…nd rabbit producers and moved the default method to build the destination String into the RowMap class
@paulhoang-hee
Copy link
Author

Hi @osheroff . I've moved the implementation to the RowMap class and deleted the previously created Interface.

Most of it went smoothly but the MaxwellKafkaProducer fallback flow was a little troublesome. It didn't have access to the RowMap instance so I used the queue's peek method to get one. Is that ok?

@paulhoang-hee
Copy link
Author

Just noticed travis came back with a broken build, guess I'll have to fix that first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants