Skip to content

Allow configuration of media type for kafka publisher #650

@tandev

Description

@tandev

Description
Is seems like the ecotone/kafka does not use the OutputDefaultConversionMediaType in the KafkaPublisherConfiguration for use with MessagePublisher::convertAndSend

It not being passed through to the OutboundMessageConverter being the reason i think because the creation of the converter is hard coded in KafkaOutboundChannelAdapter

$this->outboundMessageConverter = new OutboundMessageConverter($headerMapper);

The other outbound channel implementations using enqueue seem to support this in some capacity.

It would be nice to support this, we would need to send JSON to kafka.

Example

#[EventHandler]
    public function whenSubscriptionWasUpdated(
        OrderWasUpdated $event,

        #[Reference('produce.update')]
        MessagePublisher $messagePublisher
    ): void
    {
        $messagePublisher->convertAndSend(
            new OrderUpdated($event->getOrderId())
        );
    }

will always be converted to serialized php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions