Class CometdEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.cometd.CometdEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.ComponentAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.EndpointServiceLocation,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.0.0",
scheme="cometd,cometds",
title="CometD",
syntax="cometd:host:port/channelName",
category={NETWORKING,MESSAGING},
headersClass=CometdBinding.class)
public class CometdEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.spi.EndpointServiceLocation
Offers publish/subscribe, peer-to-peer (via a server), and RPC style messaging using the CometD/Bayeux protocol.
Using this component in combination with the dojo toolkit library it's possible to push Camel messages directly into
the browser using an AJAX based mechanism.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(CometdProducerConsumer prodcons) org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.Producervoiddisconnect(CometdProducerConsumer prodcons) intintintintgetPath()intgetPort()intgetUri()booleanbooleanbooleanbooleanvoidsetAllowedOrigins(String allowedOrigins) The origins domain that support to cross, if the crosssOriginFilterOn is truevoidsetBaseResource(String baseResource) The root directory for the web resources or classpath.voidsetCrossOriginFilterOn(boolean crossOriginFilterOn) If true, the server will support for cross-domain filteringvoidsetDisconnectLocalSession(boolean disconnectLocalSession) Whether to disconnect local sessions after publishing a message to its channel.voidsetFilterPath(String filterPath) The filterPath will be used by the CrossOriginFilter, if the crosssOriginFilterOn is truevoidsetInterval(int interval) The client side poll timeout in milliseconds.voidsetJsonCommented(boolean commented) If true, the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment.voidsetLogLevel(int logLevel) Logging level. 0=none, 1=info, 2=debug.voidsetMaxInterval(int maxInterval) The max client side poll timeout in milliseconds.voidsetMultiFrameInterval(int multiFrameInterval) The client side poll timeout, if multiple connections are detected from the same browser.voidsetSessionHeadersEnabled(boolean enable) Whether to include the server session headers in the Camel message when creating a Camel Message for incoming requests.voidsetTimeout(int timeout) The server side poll timeout in milliseconds.Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.ComponentAware
getComponentMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isRemote, isSingletonProducerMethods inherited from interface org.apache.camel.spi.EndpointServiceLocation
getServiceMetadataMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
CometdEndpoint
-
-
Method Details
-
getServiceUrl
- Specified by:
getServiceUrlin interfaceorg.apache.camel.spi.EndpointServiceLocation
-
getServiceProtocol
- Specified by:
getServiceProtocolin interfaceorg.apache.camel.spi.EndpointServiceLocation
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
connect
- Throws:
Exception
-
disconnect
- Throws:
Exception
-
getComponent
- Specified by:
getComponentin interfaceorg.apache.camel.ComponentAware- Overrides:
getComponentin classorg.apache.camel.support.DefaultEndpoint
-
getPath
-
getPort
public int getPort() -
getProtocol
-
getUri
-
getBaseResource
-
setBaseResource
The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar -
getTimeout
public int getTimeout() -
setTimeout
public void setTimeout(int timeout) The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. -
getInterval
public int getInterval() -
setInterval
public void setInterval(int interval) The client side poll timeout in milliseconds. How long a client will wait between reconnects -
getMaxInterval
public int getMaxInterval() -
setMaxInterval
public void setMaxInterval(int maxInterval) The max client side poll timeout in milliseconds. A client will be removed if a connection is not received in this time. -
getMultiFrameInterval
public int getMultiFrameInterval() -
setMultiFrameInterval
public void setMultiFrameInterval(int multiFrameInterval) The client side poll timeout, if multiple connections are detected from the same browser. -
isJsonCommented
public boolean isJsonCommented() -
setJsonCommented
public void setJsonCommented(boolean commented) If true, the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment. This is a defence against Ajax Hijacking. -
setSessionHeadersEnabled
public void setSessionHeadersEnabled(boolean enable) Whether to include the server session headers in the Camel message when creating a Camel Message for incoming requests. -
isSessionHeadersEnabled
public boolean isSessionHeadersEnabled() -
getLogLevel
public int getLogLevel() -
setLogLevel
public void setLogLevel(int logLevel) Logging level. 0=none, 1=info, 2=debug. -
getAllowedOrigins
-
setAllowedOrigins
The origins domain that support to cross, if the crosssOriginFilterOn is true -
isCrossOriginFilterOn
public boolean isCrossOriginFilterOn() -
setCrossOriginFilterOn
public void setCrossOriginFilterOn(boolean crossOriginFilterOn) If true, the server will support for cross-domain filtering -
getFilterPath
-
setFilterPath
The filterPath will be used by the CrossOriginFilter, if the crosssOriginFilterOn is true -
isDisconnectLocalSession
public boolean isDisconnectLocalSession() -
setDisconnectLocalSession
public void setDisconnectLocalSession(boolean disconnectLocalSession) Whether to disconnect local sessions after publishing a message to its channel. Disconnecting local session is needed as they are not swept by default by CometD, and therefore you can run out of memory.
-