[ 
https://issues.apache.org/jira/browse/CAMEL-12584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16523495#comment-16523495
 ] 

ASF GitHub Bot commented on CAMEL-12584:
----------------------------------------

davsclaus commented on a change in pull request #2392: CAMEL-12584:Allow seda 
producers to offer data to the queue with timeout
URL: https://github.com/apache/camel/pull/2392#discussion_r198078184
 
 

 ##########
 File path: 
camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
 ##########
 @@ -41,30 +41,32 @@
     private final WaitForTaskToComplete waitForTaskToComplete;
     private final long timeout;
     private final boolean blockWhenFull;
+    private final long offerTimeout;
 
     /**
      * @deprecated Use {@link #SedaProducer(SedaEndpoint, 
WaitForTaskToComplete, long, boolean) the other constructor}.
      */
     @Deprecated
     public SedaProducer(SedaEndpoint endpoint, BlockingQueue<Exchange> queue, 
WaitForTaskToComplete waitForTaskToComplete, long timeout) {
-        this(endpoint, waitForTaskToComplete, timeout, false);
+        this(endpoint, waitForTaskToComplete, timeout, false, 0);
     }
 
     /**
      * @deprecated Use {@link #SedaProducer(SedaEndpoint, 
WaitForTaskToComplete, long, boolean) the other constructor}.
      */
     @Deprecated
-    public SedaProducer(SedaEndpoint endpoint, BlockingQueue<Exchange> queue, 
WaitForTaskToComplete waitForTaskToComplete, long timeout, boolean 
blockWhenFull) {
-        this(endpoint, waitForTaskToComplete, timeout, blockWhenFull);
+    public SedaProducer(SedaEndpoint endpoint, BlockingQueue<Exchange> queue, 
WaitForTaskToComplete waitForTaskToComplete, long timeout, boolean 
blockWhenFull, long offerTimeout) {
 
 Review comment:
   This is fine in a new minor release

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Allow seda producers to offer data to the queue with timeout
> ------------------------------------------------------------
>
>                 Key: CAMEL-12584
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12584
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.21.0
>            Reporter: Andrew Doumaux
>            Priority: Major
>             Fix For: 2.23.0
>
>
> The seda producer only allows:
>  * adding with possible exception if queue is full
>  * blocking until space is available
> I'd like to suggest a third option for seda where a configured timeout can be 
> added to the block case.  Utilizing the .offer(timeout) method of the 
> underlining java queue
> Use Case:
> I have a Apache NiFi system doing rest posts to my Apache Camel system.  The 
> camel system attempt to put the received message onto a seda queue which is 
> backed by a SynchronousQueue.  This causes an exception to occur if no 
> threads are available to do the work requested, returns a service temporarily 
> unavailable status to NiFi and Nifi pauses it's rest posts for a short delay. 
> I'd be able to save on some network traffic I/O if I was able to say try and 
> wait 100ms before giving up on putting the data on the queue.
>  
> Concept of adding the "offer/timeout" was suggested in comments of CAMEL-1962



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to