Giter Club home page Giter Club logo

Comments (8)

acogoluegnes avatar acogoluegnes commented on June 5, 2024

@mcgiri Here's a workaround: #19 (comment)

from rabbitmq-jms-client.

acogoluegnes avatar acogoluegnes commented on June 5, 2024

There's no standard content type header in JMS. The best we can do is to provide an interface to customize the AMQP.BasicProperties.Builder:

public interface AmqpPropertiesCustomizer {
  AMQP.BasicProperties.Builder customize(AMQP.BasicProperties.Builder builder, Message jmsMessage);
}

Your implementation could be the following:

public class ContentTypeAmqpPropertiesCustomizer implements AmqpPropertiesCustomizer {

  public AMQP.BasicProperties.Builder customize(AMQP.BasicProperties.Builder builder, Message jmsMessage) {
    String contentType = jmsMessage.getStringProperty("content_type");
    if (contentType != null) {
      builder.contentType(contentType);
    }
    return builder;
  }

}

The customizer instance would be set at the RMQConnectionFactory level. @mcgiri Would that work for you?

from rabbitmq-jms-client.

mcgiri avatar mcgiri commented on June 5, 2024

@acogoluegnes -- Apologies, i am going to take couple of days to get back since I am calling it from an app which uses native JMS methods, and I need to look at options to use the interface. I guess it should work but let me come back.

from rabbitmq-jms-client.

mcgiri avatar mcgiri commented on June 5, 2024

@acogoluegnes -- Even with the interface, the content_type would still be set to "application/octet-stream" right? Is there a way to not set it at all?

from rabbitmq-jms-client.

michaelklishin avatar michaelklishin commented on June 5, 2024

As far as I can tell, that is the case. It's certainly possible to have that field blank in the underlying Java client, though.

from rabbitmq-jms-client.

acogoluegnes avatar acogoluegnes commented on June 5, 2024

@mcgiri The customizer would be applied after, so it could override the previous value of content_type.

from rabbitmq-jms-client.

mcgiri avatar mcgiri commented on June 5, 2024

@acogoluegnes Can you please include the interface? I should be able to use it. Sorry for the delay again. Thanks!

from rabbitmq-jms-client.

acogoluegnes avatar acogoluegnes commented on June 5, 2024

@mcgiri 1.9.0.RC1 has shipped with this feature, you can give it a try.

from rabbitmq-jms-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.