JMSQueueAppender and JMSTopicAppender implements many common code

Hi. I am extending some classes for JMS logging, and I want to share my thoughts. 1) Queue and Topic Appender share a lot of common code. The only difference is at JMS level (for example, QueueSession and TopicSession). 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); msg.setObject(so); queueSender.send(msg); Proposed code (on JMSAppenderBase): ObjectMessage msg = getSession().createObjectMessage(); Serializable so = pst.transform(event); msg.setObject(so); getSender().send(msg); 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. Regards. Ramon
participants (1)
-
Ramon Gordillo