Giter Club home page Giter Club logo

Comments (9)

michaelklishin avatar michaelklishin commented on June 1, 2024

It's generally up to applications to set and decide how to interpret message content type. @acogoluegnes thoughts?

from rabbitmq-jms-client.

acogoluegnes avatar acogoluegnes commented on June 1, 2024

@amitkapps I understand text/plain would make more sense for TextMessages, but as @michaelklishin suggested, applications should set and interpret the content type. Does it make sense the JMS client sets text/plain while the message actually carries JSON?

The sending application could set the content type on the JMS message:

TextMessage msg = session.createTextMessage("Hello world");
msg.setStringProperty("content-type", "text/plain");

An AMQP receiver could then get the content type from the headers:

public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
  properties.getHeaders().get("content-type");
}

from rabbitmq-jms-client.

michaelklishin avatar michaelklishin commented on June 1, 2024

The JSON point is a very good one. I don't think we should do it.

from rabbitmq-jms-client.

amitkapps avatar amitkapps commented on June 1, 2024

@acogoluegnes @michaelklishin thanks for the feedback.
This would work, however it requires changes both on the client jms side as well as, say, an amqp receiver.
Currently, if I were to set the stringProperty content-type text/plain on the jms producer side, it would not make the amqp consumer think its a text messages since the contentType property on the amqp message is always being hardcoded as application/octet-stream.

It would help with jms > ampq interoperability. Otherwise you're forced to handle that differently on the consumer side, whereas the amqp spec already provides first class support for MIME types with basic.content-type property string.

from rabbitmq-jms-client.

michaelklishin avatar michaelklishin commented on June 1, 2024

Unfortunately we cannot assume that every TextMessage actually contains text (and not a text-based encoded values as in the JSON example above).

from rabbitmq-jms-client.

amitkapps avatar amitkapps commented on June 1, 2024

How about some ability to transparently map a set of incoming jms headers to amqp headers.
Case in point- if a jms header String property comes in as content-type that could get mapped to the equivalent AMQP header.
A similar strategy could possibly also apply to other header properties as well.

from rabbitmq-jms-client.

michaelklishin avatar michaelklishin commented on June 1, 2024

This is not a venue for discussions. Smarter is not always better when it comes to libraries. Just set the damn field.

from rabbitmq-jms-client.

amitkapps avatar amitkapps commented on June 1, 2024

Not meant for discussions really?
great argument. Moving on....

from rabbitmq-jms-client.

michaelklishin avatar michaelklishin commented on June 1, 2024

@amitkapps yes, really. Discussions belong to the mailing list. That's how our team operates, whether you like it or not. Sorry not sorry.

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.