ibm-messaging / kafka-connect-mq-source

This repository contains a Kafka Connect source connector for copying data from IBM MQ into Apache Kafka.
Apache License 2.0
95 stars 83 forks source link

💡 [mq.record.key.header] - <JMSMessageID> #137

Closed AishD3 closed 1 month ago

AishD3 commented 2 months ago

Description

JMSMessageID right now coming as String , Is there any configuration that can send it as Struct.

Suggested Solution

JMSMessageID right now coming as String , Is there any configuration that can send it as Struct.

Alternatives

JMSMessageID right now coming as String , Is there any configuration that can send it as Struct.

Additional Context

JMSMessageID right now coming as String , Is there any configuration that can send it as Struct.

dalelane commented 2 months ago

I suspect it would be difficult to do this through configuration alone in a generic way that would work with all use cases.

For specific requirements like this, I recommend writing your own custom RecordBuilder class. This would involve creating a new class by subclassing the existing record builder you are already using (the class that you've set the config option mq.record.builder to point to) to reuse almost all of the existing implementation. You can override the existing getKey(JMSContext, String, Message) method so that it returns a struct to your specific requirements. Then you just need to update the mq.record.builder config option to point at your new class.

Joel-hanson commented 1 month ago

You could do this with a custom DefaultMessageBuilder, we won't make this a generic feature. Here the link to one of the example to do this https://ibm.github.io/event-automation/es/connecting/mq/sink/#enabling-mqmd