@@ -172,36 +172,76 @@ public class BootstrapController {
172172
173173## Message Converter Configuration
174174
175- To customize message conversion, set the property
176- ` rqueue.message.converter.provider.class ` to the fully qualified name of your provider
177- class. This class must implement the ` MessageConverterProvider ` interface and return
175+ To customize message conversion, set the property
176+ ` rqueue.message.converter.provider.class ` to the fully qualified name of your provider
177+ class. This class must implement the ` MessageConverterProvider ` interface and return
178178a Spring ` MessageConverter ` .
179179
180180{: .note}
181- Your custom provider must implement
181+ Your custom provider must implement
182182` com.github.sonus21.rqueue.converter.MessageConverterProvider ` .
183183
184184``` java
185185class MyMessageConverterProvider implements MessageConverterProvider {
186186
187187 @Override
188188 public MessageConverter getConverter () {
189- // here any message converter can be returned except null
189+ // here any message converter can be returned except null
190190 return new MyMessageConverter ();
191191 }
192192}
193193```
194194
195- The ` DefaultRqueueMessageConverter ` handles serialization for most use cases, but it
196- may fail if classes are not shared between producing and consuming applications. To
197- avoid shared dependencies, consider using JSON-based converters like
198- ` com.github.sonus21.rqueue.converter.JsonMessageConverter ` or Spring's
199- ` JacksonJsonMessageConverter ` . These serialize payloads into JSON, improving
195+ The ` DefaultRqueueMessageConverter ` handles serialization for most use cases, but it
196+ may fail if classes are not shared between producing and consuming applications. To
197+ avoid shared dependencies, consider using JSON-based converters like
198+ ` com.github.sonus21.rqueue.converter.JsonMessageConverter ` or Spring's
199+ ` JacksonJsonMessageConverter ` . These serialize payloads into JSON, improving
200200interoperability.
201201
202- Other serialization formats like MessagePack or Protocol Buffers (ProtoBuf) can also
202+ Other serialization formats like MessagePack or Protocol Buffers (ProtoBuf) can also
203203be implemented based on your requirements.
204204
205+ ### Generic Envelope Types
206+
207+ ` GenericMessageConverter ` (used by the default converter) supports ** single-level
208+ generic envelope types** such as ` Event<T> ` . The type parameter is resolved at
209+ serialization time by inspecting the runtime class of the field value that corresponds
210+ to ` T ` .
211+
212+ ``` java
213+ // A generic envelope type
214+ public class Event <T> {
215+ private String id;
216+ private T payload;
217+ // getters/setters ...
218+ }
219+
220+ // Enqueue
221+ Event<Order > event = new Event<> (" evt-123" , order);
222+ rqueueMessageEnqueuer. enqueue(" order-queue" , event);
223+
224+ // Consume
225+ @RqueueListener (value = " order-queue" )
226+ public void onEvent(Event<Order > event) { ... }
227+ ```
228+
229+ The serialized form encodes both the envelope class and the type parameter:
230+
231+ ```
232+ {"msg":"...","name":"com.example.Event#com.example.Order"}
233+ ```
234+
235+ ** Constraints:**
236+
237+ - The type parameter ` T ` must be a ** non-generic** concrete class (e.g. ` Order ` , not
238+ ` List<Order> ` ).
239+ - At least one field of type ` T ` on the envelope class must be ** non-null** at
240+ serialization time, so the runtime type can be determined.
241+ - For ` List<T> ` , items must also be non-generic concrete classes. Envelopes like
242+ ` List<Event<Order>> ` are not supported.
243+ - Multi-level nesting (e.g. ` Wrapper<Event<T>> ` ) is not supported.
244+
205245## Additional Configuration
206246
207247- ** ` rqueue.retry.per.poll ` ** : Determines how many times a polled message is retried
0 commit comments