[
https://issues.apache.org/jira/browse/CAMEL-7905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14228156#comment-14228156
]
Daniel edited comment on CAMEL-7905 at 11/28/14 8:48 AM:
---------------------------------------------------------
[~boday] - Even if it sounds wrong in the first place, I actually would discard
the messages.
In the scenario described above, it is a valid situation that there is no
consumer for a direct endpoint. And what else would you want to do, if no one
is interested in the messages an endpoint produces, but to discard the
messages. You can't wait as you don't know, if there will ever be a consumer
for the message and you probably would not want an Exception to be thrown as
Exceptions are a very costly way for flow-control, if they occur on a regular
basis in a "normal" application state. That is discarding the message is the
best option you have. As this is may lead to message loss where endpoints
without consumers are not a valid application state, this definitively should
be an opt-in option!
was (Author: dpr):
[~boday] - Even if it sounds wrong in the first place, I actually would discard
the messages.
In the scenario described above, it is a valid situation that there is no
consumer for a direct endpoint. And what else would you want to do, if no one
is interested in the messages an endpoint produces, but to discard the
messages. You can't wait as you don't know, if there will ever be a consumer
for the message and you probably would not want an Exception to be thrown as
Exceptions are a very costly way for flow-control, if they occur on a regular
basis in a "normal" application state. That is discarding the message is the
best option you have. As this is may lead to messages loss where endpoints
without consumers are not a valid application state, this definitively should
be an opt-in option!
> New option to ignore missing consumers on direct endpoints
> ----------------------------------------------------------
>
> Key: CAMEL-7905
> URL: https://issues.apache.org/jira/browse/CAMEL-7905
> Project: Camel
> Issue Type: Improvement
> Affects Versions: 2.14.0
> Reporter: Daniel
>
> Currently a {{DirectConsumerNotAvailableException}} or
> {{DirectVmConsumerNotAvailableException}} is thrown when a message is send
> via a direct endoint and no consumer has been set up for this endpoint.
> In a current scenario I want to use camel to loosely couple two components
> using direct endpoints that _might_ be consumed by some bean. Especially
> there should be no dependency from the producing component to the consuming
> component. However, if there is a consumer, messages send from the producer
> must be consumed synchronously in the same thread to preserve the transaction
> context of the producer. That why I chose {{direct}} for the producer's
> endpoint.
> What is meant by "the messages might be consumed" is that the consuming
> component might not be deployed, when the consumer produces the first
> messages, or perhaps will never be deployed. I know there is the {{block}}
> option for the {{direct}} component but I don't want the producer to wait for
> the consumer as it might take some time (possibly forever) for the consumer
> to be available.
> I think this is a very common scenario for a messaging system and I was
> surprised not to find an easy out-of-the-box way to handle this with camel.
> That's why I think an additional option {{failIfNoConsumers}} (similar to the
> option for the seda component) for the {{direct}} and {{direct-vm}} component
> would be very handy.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)