Is is it possible to consume user-defined headers using Try me in console?

techrahul95
techrahul95 Member Posts: 20 ✭✭

we are using PubSub+ Kafka source connector as a consumer, so is it possible to consumer the user defined header using PubSub+ Kafka source connector?

Best Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin
    #2 Answer ✓

    Hi @techrahul95,

    I assume you're asking about the "Try-Me" in PubSub+ Manager. If so, no it can't set user defined headers. Maybe one of these 2 options will work for you?

    Hope that helps!

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin
    #3 Answer ✓

    Hi @techrahul95,

    You can put whatever you'd like into the payload of the message. You would just have to make sure the consumers know what to expect so they can properly parse it.

    But I would caution against not using user-defined properties just b/c the try-me tool doesn't allow you to do so. In many cases it makes a lot of sense to use user-defined properties as they can allow the consumers to know context about the message they are receiving. Things like an ApplicationMessageID, OrderID, type information, etc. are very common

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin
    #4 Answer ✓

    Hi @techrahul95,

    I assume you're asking about the "Try-Me" in PubSub+ Manager. If so, no it can't set user defined headers. Maybe one of these 2 options will work for you?

    Hope that helps!

  • techrahul95
    techrahul95 Member Posts: 20 ✭✭

    Thanks @marc. I thought so - Can we include the user-defined headers in the message payload and process them in consumer applications ?

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 959 admin
    #6 Answer ✓

    Hi @techrahul95,

    You can put whatever you'd like into the payload of the message. You would just have to make sure the consumers know what to expect so they can properly parse it.

    But I would caution against not using user-defined properties just b/c the try-me tool doesn't allow you to do so. In many cases it makes a lot of sense to use user-defined properties as they can allow the consumers to know context about the message they are receiving. Things like an ApplicationMessageID, OrderID, type information, etc. are very common

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 636 admin

    Not related to the Try Me! functionality: but if you're asking specifically about this Kafka source connector: https://github.com/SolaceProducts/pubsubplus-connector-kafka-source I just did a quick scan of the code and found no mentions of Header (Kafka) or SDTMap (Solace). So it doesn't appear that if User Properties are specified in the received Solace message, they will be passed through to the Kafka side.

    Note the code is open source... you could either add the functionality yourself and submit a PR, or raise an Issue so we can track this as a feature request.

  • techrahul95
    techrahul95 Member Posts: 20 ✭✭

    Thanks @Aaron,

    I will submit the feature enhancement request and work on submitting a PR in meantime.

    Appreciated your support.

    Regards,

    Rahul.😊