[ 
https://issues.apache.org/jira/browse/CAMEL-7949?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aaron Whiteside updated CAMEL-7949:
-----------------------------------
    Attachment: CAMEL-7949.patch

Breakdown of changes for review:

{code}
AbstractMessageHandler
- Removed commitStrategy field and corresponding getter, not used anywhere.
- Updated to use JmsMessageHelper instead of SjmsExchangeMessageHelper.

InOutMessageHandler
- Updated to use JmsMessageHelper instead of SjmsExchangeMessageHelper.
- Updated to use JmsConstants.
- Fixed typo in inner class name MessageHandlerAsyncCallback
- close() cleaned up, no point wrapping an exception if you're not going to 
throw it.

InOnlyMessageHandler
- Minor cleanup to handleMessage()

JmsConstants
- None of the existing constants were used by anything, so removed those.
- Made the class into an interface.
- Moved all the JMS constants from JmsMessageHelper into here.
- Added two more to do with JMS delivery mode.

InOutProducer
- TreeMap replaced with ConcurrentHashMap, because..
  - Non-static lock was guarding a static field.. so not really useful.
  - MessageConsumerResourcesFactory.makeObject() anonymous 
MessageListener.onMessage() was accessing exchangeMap without using the lock. I 
seriously doubt we need the TreeMap and lock, a ConcurrentHashMap will surely 
be good enough, I suspect the tester got better performance because they were 
not actually aquiring the read lock... and/or had separate write locks per 
instance of InOutProducer.
- Constructor, removed pointless call to Endpoint.getConsumerCount().
- MessageConsumerResourcesFactory.makeObject() anonymous 
MessageListener.onMessage() swallows Exceptions by wrapping them and never 
throwing them.
- sendMessage(), now uses JmsMessageHelper instead of SjmsExchangeMessageHelper
- sendMessage(), now uses JmsConstants instead of hardcoded strings.
- sendMessage(), removed usage of lock.

InOnlyProducer
- sendMessage(), updated to use the simpler version of the 
JmsMessageHelper.createMessage() method.


JmsMessageHeaderType
- Duplicated constants in JmsMessageHelper.
- Replaced by JmsConstants.
- Class no longer needed.

JmsMessageHelper
- now implements JmsConstants, constants moved into JmsConstants.
- createMessage()
 - use entrySet() instead of keySet() for Map conversion, more efficient.
 - StreamMessage is not a InputStream message... updated to work off a 
Collection instead, much closer to what a StreamMessage is.
 - Only use toString() value of key for Map messages.
- setProperty(), now allows null values as per the JMS spec.
- discoverMessageTypeFromPayload()
 - Corrected Byte[] to byte[], as no one uses Byte[]'s.
 - Collection is no longer mapped to Map, collection is mapped to Stream.
 - Map is mapped to Map.
 - Added CharBuffer to Text conversion.
 - Fixed Reader to Text conversion, as Readers deal with chars not bytes.

SjmsExchangeMessageHelper
- Duplicated code with JmsMessageHelper, so moved non duplicated methods to 
JmsMessageHelper and deleted class.
- Moved methods:
  - hasIllegalHeaderKey
  - getJMSReplyTo
  - setJMSReplyTo
  - getJMSType
  - setJmsMessageHeaders
  - createMessage
  - populateExchange
  - createExchange


JMSMessageHelperTypeConversionTest
- Renamed JmsMessageHelperTypeConversionTest to match JmsMessageHelper class 
name.
- Added test for Map conversion.
- Added test for byte[] conversion.
- Added test for CharBuffer conversion.
- Fixed Reader conversion test.
- Fixed StringReader conversion test.

{code}

> JmsMessageHelper to support automatic conversion from ByteBuffer to 
> BytesMessage
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-7949
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7949
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sjms
>    Affects Versions: 2.14.0
>            Reporter: Aaron Whiteside
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.15.0
>
>         Attachments: CAMEL-7949.patch
>
>
> JmsMessageHelper to support automatic conversion from ByteBuffer to 
> BytesMessage.
> Looking at the code, byte[] and InputStream conversion to BytesMessage could 
> utilize camel's built in type conversion functionality and not reimplement it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to