0

Hello this question is related to this and I'd like to know if there is any way to set ContentType header in qpid in JMS context. We are using JmsConnectionFactory and spring's JMS library.

I was trying to find some way using extension but can't find the way or if that's even possible.

    final org.apache.qpid.jms.JmsConnectionFactory jmsConnectionFactory = new org.apache.qpid.jms.JmsConnectionFactory();
    jmsConnectionFactory.setExtension("headers", (connection, uri) -> {
      if (connection instanceof JmsConnection) {

      }
    });
bilak
  • 4,526
  • 3
  • 35
  • 75
  • FWIW, `JmsConnectionFactory` is an ambiguous identifier. You should specify the entire class name including the package so it's clear what actual class you're using. – Justin Bertram Jan 28 '21 at 17:41
  • it's qpid library, but yes I'll update the question – bilak Jan 28 '21 at 17:52

1 Answers1

0

There is no exposed means of setting the content-type on the messages sent from the Qpid JMS client. The client itself uses this field as part of the JMS mapping to AMQP to distinguish certain message types that it sends and to determine at receive time what certain messages should be presented as.

It is technically possible to use reflection to reach in and so the value but the APIs you have to use from the JmsMessageFacade class are not public and could change with any release so choosing to do so comes with significant risk.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • well, you are [not right](https://github.com/Azure/azure-sdk-for-java/issues/18852#issuecomment-773922436) – bilak Feb 05 '21 at 09:51