[
https://issues.apache.org/jira/browse/CAMEL-7908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aaron Whiteside updated CAMEL-7908:
-----------------------------------
Attachment: destination_creation_strategy.patch
Attached new patch, rebased from latest changes. Now with unit tests! ;)
I've also broken down the major changes in this patch with comments for better
understanding, I'm hoping you'll see my point of view and accept this patch
into the 2.14.X branch..
{quote}
Changes to JmsObjectFactory
Methods that were deleted, because they were directly replaced by
DestinationCreationStrategy
- createDestination()
- createQueue()
- createTemporaryDestination()
- createTopic()
Methods that were deleted, because they took a Session to create a Destination
and then went on to call createMessageConsumer() with said Destination. Since
DestinationCreationStrategy replaces all creation of Destinations these methods
were no longer needed.
- createQueueConsumer()
- createTopicConsumer()
- createTemporaryMessageConsumer()
Methods that were not used anywhere in the code base. I could put these back if
really needed, but since no one was using them I figured it's cleaner to not
have them, after all they are there in the version control history.
- createQueueProducer()
- createTopicProducer()
Methods changed to accept a Destination instead of a String destination, and
the logic of Destination creation was moved out into
DestinationCreationStrategy.
- createMessageConsumer()
- createMessageProducer()
Changes to InOnlyProducer.doCreateProducerModel()
- Corrected usage of try {} finally {} block. Also simplies the code, no need
for null check anymore.
- replaced 'if (isEndpointTransacted())' and 'if (getCommitStrategy() != null)'
with ternary operators, to provide cleaner code.
- Added call to DestinationCreationStrategy to create the Destination before
calling JmsObjectFactory.createMessageProducer.
- Better to fail hard, don't return a null resource, error out instead.
Exception will propagate back up to SjmsProducer.doStart().
Changes to InOutProducer
Changes to doCreateProducerModel()
- Corrected usage of try {} finally {} block. Also simplies the code, no need
for null check anymore.
- replaced 'if (isEndpointTransacted())' with ternary operator, for cleaner
code.
- Added call to DestinationCreationStrategy to create the Destination before
calling JmsObjectFactory.createMessageProducer.
- removed null checks, because 1) JMS specification says that
connection.createSession() will return a non null value or throw an exception.
2) provide consistency with InOnlyProducer.
- Better to fail hard, don't return a null resource, error out instead.
Exception will propagate back up to SjmsProducer.doStart().
Changes to sendMessage()
- Corrected usage of try {} finally {} block and Lock, reference
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.html
Changes to MessageConsumerResourcesFactory.makeObject()
- Corrected usage of try {} finally {} block with borrowConnection().
- No default NULL value for the 'answer' variable, as the method should either
throw an exception or return non-null.
Removed inner class InternalTempDestinationListener
- Not used anywhere. Cleaner code, history will be in version control..
{quote}
> Add a DestinationCreationStrategy to the SJMS component
> -------------------------------------------------------
>
> Key: CAMEL-7908
> URL: https://issues.apache.org/jira/browse/CAMEL-7908
> Project: Camel
> Issue Type: Improvement
> Components: camel-sjms
> Affects Versions: 2.14.0
> Reporter: Aaron Whiteside
> Priority: Minor
> Fix For: 2.15.0
>
> Attachments: destination_creation_strategy.patch, unnamed2.patch
>
>
> Add a DestinationCreationStrategy to the SJMS component
> JMS implementations like HornetQ do not allow dynamic queue/topic creation
> via the pure JMS API's. Extending SJMS with a DestinationCreationStrategy
> would allow one to replace the DefaultDestinationCreationStrategy with a
> provider specific one that in the case of HornetQ dynamically creates the
> queue/topic using the correct management API.
> Implementation note:
> JmsObjectFactory::createMessageProducer would be modified to supply a
> DestinationCreateionStrategy, it would then use this to obtain Destination's.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)