[logback-dev] JMSQueueAppender and JMSTopicAppender implements many common code

Ramon Gordillo gordillo.ramon at gmail.com
Wed May 27 13:22:17 CEST 2015


I am extending some classes for JMS logging, and I want to share my

1) Queue and Topic Appender share a lot of common code.

The only difference is at JMS level (for example, QueueSession and
So I wonder if it is possible to implement the common code at parent level
(JMSAppenderBase), using common methods (like getter getSession) and
override those common methods in the children. Example:

Current code (JMSQueueAppender):

ObjectMessage msg = queueSession.createObjectMessage();
Serializable so = pst.transform(event);

Proposed code (on JMSAppenderBase):

ObjectMessage msg = getSession().createObjectMessage();
Serializable so = pst.transform(event);

Proposed code (on JMSQueueAppender):

public Session getSession(){
    return getQueueSession()

Proposed code (on JMSTopicAppender):

public Session getSession(){
    return getTopicSession()

and same for getSender().

2) JMS Serialization can only send ObjectMessage. Following the same
approach as encoders, it will be very useful to provide other kind of
serialization, like MapMessage, TextMessage + Headers, etc.

Currently, I have done exactly this in my project but manually overriding
the methods. Configuring the serialization through configuration will be
more elegant and extensible.

Please, share your thoughts.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20150527/165ca723/attachment.html>

More information about the logback-dev mailing list