-
Notifications
You must be signed in to change notification settings - Fork 442
Exchange messages between applications #448
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
Comments
Could you show please post enqueue configs for both apps |
What broker do you use? |
In
and this conf
And in `ApplicationB
and the consumer
I'm using In application B, as you can see, I had to specifiy |
Hi @hpatoio Did you figure out a solution ? It seems to me you have mixed topic and queue name when you wrote
By using sendEvent, message is sent to topic. I'm working on the same use case with two apps, with a specific queue for communication from A to B. I whished to be able to specify a topic in order to use the "client" in application B (does that makes sense after all ?) but just ended up using transport for consuming messages from that specific queue instead. |
I did not find a solution. I've also opened this #459 where the author tells me to use "transport" directly (that it seems that is what you did)
Can I see the code somewhere ? |
In application A, I've organized message publishing in two separate steps:
it looks like this
On application B, I have a dedicated processor I call from the enqueue:transport:consume command |
class IncomingEmailProcessor implements PsrProcessor, TopicSubscriberInterface
{
public static function getSubscribedTopics()
{
return [
'from_a_to_b' => [
'queueName' => 'does_not_matter',
'queueNameHardcoded' => true
],
'another_topic_here' => [
'queueName' => 'can_be_differrent',
'queueNameHardcoded' => true
],
];
}
public function process(PsrMessage $message, PsrContext $session)
{
// Do something
}
} What enqueue will do in this case is build a mapping from topic to [processor,queueName] and keep it in its RouterProcessor. Whenever a message is received on a topic, the router will publish messages back to the broker for each queue subscribed to that topic. Actually if you make another processor class AnotherProcessor implements PsrProcessor, TopicSubscriberInterface
{
public static function getSubscribedTopics()
{
return ['from_a_to_b' => ['queueName' => 'another_queue_name', 'queueNameHardcoded' => true]];
}
public function process(PsrMessage $message, PsrContext $context) { ... }
} it will also receive any message published on the "from_a_to_b" topic because enqueue's router will publish itself messages to all processor queues for which the processors have advertised themselves as subscribed to "from_a_to_b" topic. |
Thank you very much for your examples @amne 👍 This "routing" operated by enqueue was confusing me and now it starts to be a bit clearer... If I read your example in a context of 2 different apps A & B, I understand you would send a message to a 'from_a_to_b' topic from A, and in B, you would create your |
@kermorgant yes, that is correct. |
Thanks @amne. Sorry, it was a dumb question, I had lost the op's context... I'm still a bit confused by several things about this scenario :
I'm probably still missing some pieces to get the "big picture". I've only tested it with dbal so far, which perhaps gives me a particuliar bias too. |
SQS transport does not support message\enterprise bus, It could if #252 is done. Also note that two applications should have different app_name set. |
I've 2 symfony applications and I need to consume in
ApplicationB
messages generated byApplicationA
In
ApplicationA
I'veIn
ApplicationB
I'veBut I don't receive any message on
ApplicationB
where do I go wrong ?This seems related to #296 and #196
The text was updated successfully, but these errors were encountered: