All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.osinka.camel.beanstalk.BeanstalkComponent Maven / Gradle / Ivy

There is a newer version: 1.7.0
Show newest version
/**
 * Copyright (C) 2010 Osinka 
 *
 * Licensed 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 com.osinka.camel.beanstalk;

import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;

/**
 * Beanstalk Camel component.
 *
 * URI is beanstalk://[host[:port]][/tube]?query
 * 

* Parameters:

    *
  • command - one of "put", "release", "bury", "touch", "delete", "kick". * "put" is the default for Producers.
  • *
  • jobPriority
  • *
  • jobDelay
  • *
  • jobTimeToRun
  • *
  • consumer.onFailure
  • *
* * @author Alexander Azarov * @see BeanstalkEndpoint * @see ConnectionSettingsFactory */ public class BeanstalkComponent extends DefaultComponent { public static final String DEFAULT_TUBE = "default"; public final static String COMMAND_BURY = "bury"; public final static String COMMAND_RELEASE = "release"; public final static String COMMAND_PUT = "put"; public final static String COMMAND_TOUCH = "touch"; public final static String COMMAND_DELETE = "delete"; public final static String COMMAND_KICK = "kick"; public final static long DEFAULT_PRIORITY = 1000; // 0 is highest public final static int DEFAULT_DELAY = 0; public final static int DEFAULT_TIME_TO_RUN = 60; // if 0 the daemon sets 1. static ConnectionSettingsFactory connFactory = ConnectionSettingsFactory.DEFAULT; public BeanstalkComponent() { } public BeanstalkComponent(final CamelContext context) { super(context); } @Override protected Endpoint createEndpoint(final String uri, final String remaining, final Map parameters) throws Exception { return new BeanstalkEndpoint(uri, this, connFactory.parseUri(remaining)); } /** * Custom ConnectionSettingsFactory. *

* Specify which {@link ConnectionSettingsFactory} to use to make connections to Beanstalkd. Especially * useful for unit testing without beanstalkd daemon (you can mock {@link ConnectionSettings}) * * @param connFactory * @see ConnectionSettingsFactory */ public static void setConnectionSettingsFactory(ConnectionSettingsFactory connFactory) { BeanstalkComponent.connFactory = connFactory; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy