Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider United Messaging Model #1024

Open
hantsy opened this issue Jan 24, 2025 · 0 comments
Open

Consider United Messaging Model #1024

hantsy opened this issue Jan 24, 2025 · 0 comments
Labels
EE12 Issues being targetd for Jakarta EE 12

Comments

@hantsy
Copy link

hantsy commented Jan 24, 2025

Currently, Jakarta Messaging has its own text and binary message definition, and WebSocket supports InputStream, String, StringReader, etc. We can get the inspiration from Spring framework, Spring Integration, etc to unite the messaging model.

Use headers/body or properties/payload to describe a message at runtime.

record Message<T>(Map<String, Object> headers, T body){}

With the message conversion #1023 support, in Jakarta Messaging and WebSocket, we can use a simple type-safe approach to get the message payload directly.

Jakarta Messaging and WebSocket can adapt the Message to simplify the development for developers. In WebSocket lifecycle hook methods or Jakarta messaging listener methods, it can accept the message headers and payload as parameters directly.

public void onMessage(
  @Headers Map<String, Object> headers, 
  @Payload MyObject payload
)

public void onMessage(Message message)

public void onMessage(MyObject payload) // none `Message` type, it is a payload directly

And headers and payload should be available in the Jakarta Messaging Lisneter selector EL as described in jakartaee/messaging#243 (comment)

@ivargrimstad ivargrimstad added the EE12 Issues being targetd for Jakarta EE 12 label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EE12 Issues being targetd for Jakarta EE 12
Projects
None yet
Development

No branches or pull requests

2 participants