Return-Path: Delivered-To: apmail-activemq-camel-commits-archive@locus.apache.org Received: (qmail 2605 invoked from network); 11 Feb 2008 17:54:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2008 17:54:26 -0000 Received: (qmail 68724 invoked by uid 500); 11 Feb 2008 17:54:20 -0000 Delivered-To: apmail-activemq-camel-commits-archive@activemq.apache.org Received: (qmail 68700 invoked by uid 500); 11 Feb 2008 17:54:20 -0000 Mailing-List: contact camel-commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-commits@activemq.apache.org Received: (qmail 68691 invoked by uid 99); 11 Feb 2008 17:54:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Feb 2008 09:54:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Feb 2008 17:53:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 087C31A983E; Mon, 11 Feb 2008 09:54:06 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r620555 - /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java Date: Mon, 11 Feb 2008 17:54:05 -0000 To: camel-commits@activemq.apache.org From: jstrachan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080211175406.087C31A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jstrachan Date: Mon Feb 11 09:54:04 2008 New Revision: 620555 URL: http://svn.apache.org/viewvc?rev=620555&view=rev Log: added a helper class Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java (with props) Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java?rev=620555&view=auto ============================================================================== --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java (added) +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java Mon Feb 11 09:54:04 2008 @@ -0,0 +1,48 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.processor.loadbalancer; + +import org.apache.camel.Endpoint; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.impl.DefaultConsumer; + +/** + * Represents a consumer which on starting registers itself with a {@link LoadBalancer} and on closing unregisters + * itself with a load balancer + * + * @version $Revision: 1.1 $ + */ +public class LoadBalancerConsumer extends DefaultConsumer { + private final LoadBalancer loadBalancer; + + public LoadBalancerConsumer(Endpoint endpoint, Processor processor, LoadBalancer loadBalancer) { + super(endpoint, processor); + this.loadBalancer = loadBalancer; + } + + @Override + protected void doStart() throws Exception { + loadBalancer.addProcessor(getProcessor()); + } + + @Override + protected void doStop() throws Exception { + loadBalancer.removeProcessor(getProcessor()); + } +} Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java ------------------------------------------------------------------------------ svn:eol-style = native