devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Clarify attributes on Message config topic

Open WileESpaghetti opened this issue 4 years ago • 6 comments

General issue

Topic: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/message-queues/config-mq.html

Description:

In the section about communication.xml the document should go into a bit more detail about the difference between the schema and request attribute of <topic>. They both seem to be a way to encode message data and online tutorials seem to randomly choose one.

I'm also unclear about the difference between a handler in communication.xml and the handler attribute of publishers/consumers in queue_consumer.xml and queue_publisher.xml. I'm also not clear on when handlers are required.

WileESpaghetti avatar Apr 25 '20 03:04 WileESpaghetti

We will need some technical expertise here. Maybe an architect? 😺

shrielenee avatar Apr 30 '20 18:04 shrielenee

@nitish-ranjan05 There has been no activity on this issue so this will be moved back to Ready for Grooming.

shrielenee avatar Sep 03 '20 18:09 shrielenee

@paliarush Can we get a little guidance on this please?

dobooth avatar Sep 17 '20 18:09 dobooth

In the section about communication.xml the document should go into a bit more detail about the difference between the schema and request attribute of . They both seem to be a way to encode message data and online tutorials seem to randomly choose one.

Topics in communication.xml should be treated as interfaces. Each interface must have arguments defined and may or may not have return type specified, depending whether the interface is synchronous or asynchronous.

If you have existing service interface which will be used as a handler for the messages, it makes sense to rely on its arguments and return types by specifying schema attribute on the <topic>.

In other cases, simple/complex type should be specified as request type for the topic. And if the topic is synchronous, the response should also be given as simple or complex type.

I'm also unclear about the difference between a handler in communication.xml and the handler attribute of publishers/consumers in queue_consumer.xml and queue_publisher.xml. I'm also not clear on when handlers are required.

communication.xml was introduced to abstract the interface from the implementation. The implementation based on message queue transport is declared in queue_consumer.xml, queue_publisher.xml and queue_topology.xml. It was initially planned that event broker or web-hooks will be used as alternative transports, but this was never implemented.

Handler defines how the message will be processed by the consumer. So the handler must be defined for each topic either in communication.xml or in queue_consumer.xml, or in both.

The ability to specify handler on multiple levels was given for flexibility: in case handler implementation based on specific transport need to be different, it can be overridden on the transport layer, in case of message queue - in queue_consumer.xml. By default it is okay to always have handler specified in communication.xml.

Additional reference: https://devdocs.magento.com/guides/v2.4/extension-dev-guide/message-queues/config-mq.html

paliarush avatar Sep 28 '20 20:09 paliarush

@magento I am working on this

Santoshziffity avatar Feb 22 '21 08:02 Santoshziffity

@Santoshziffity Are you still working on this?

erikmarr avatar May 12 '21 14:05 erikmarr