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.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
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connect
(CometdProducerConsumer prodcons) org.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
void
disconnect
(CometdProducerConsumer prodcons) int
int
int
int
getPath()
int
getPort()
int
getUri()
boolean
boolean
boolean
boolean
void
setAllowedOrigins
(String allowedOrigins) The origins domain that support to cross, if the crosssOriginFilterOn is truevoid
setBaseResource
(String baseResource) The root directory for the web resources or classpath.void
setCrossOriginFilterOn
(boolean crossOriginFilterOn) If true, the server will support for cross-domain filteringvoid
setDisconnectLocalSession
(boolean disconnectLocalSession) Whether to disconnect local sessions after publishing a message to its channel.void
setFilterPath
(String filterPath) The filterPath will be used by the CrossOriginFilter, if the crosssOriginFilterOn is truevoid
setInterval
(int interval) The client side poll timeout in milliseconds.void
setJsonCommented
(boolean commented) If true, the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment.void
setLogLevel
(int logLevel) Logging level.void
setMaxInterval
(int maxInterval) The max client side poll timeout in milliseconds.void
setMultiFrameInterval
(int multiFrameInterval) The client side poll timeout, if multiple connections are detected from the same browser.void
setSessionHeadersEnabled
(boolean enable) Whether to include the server session headers in the Camel message when creating a Camel Message for incoming requests.void
setTimeout
(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, toString
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.camel.ComponentAware
getComponent
Methods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducer
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
CometdEndpoint
-
-
Method Details
-
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
connect
- Throws:
Exception
-
disconnect
- Throws:
Exception
-
getComponent
- Specified by:
getComponent
in interfaceorg.apache.camel.ComponentAware
- Overrides:
getComponent
in 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.
-