Package org.apache.camel.component.xmpp
Class XmppEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.xmpp.XmppEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.spi.HeaderFilterStrategyAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="1.0",
scheme="xmpp",
title="XMPP",
syntax="xmpp:host:port/participant",
alternativeSyntax="xmpp:user:password@host:port/participant",
category={CHAT,MESSAGING},
headersClass=XmppConstants.class)
public class XmppEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.spi.HeaderFilterStrategyAware
Send and receive messages to/from an XMPP chat server.
-
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 TypeMethodDescriptionorg.jivesoftware.smack.tcp.XMPPTCPConnectionorg.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.Producerprotected Stringorg.apache.camel.Producerorg.apache.camel.ProducercreatePrivateChatProducer(String participant) org.apache.camel.Producerorg.apache.camel.Producerprotected voiddoStop()org.jivesoftware.smack.ConnectionConfigurationstatic StringgetConnectionMessage(org.jivesoftware.smack.XMPPConnection connection) intorg.apache.camel.spi.HeaderFilterStrategygetHost()intgetPort()getRoom()protected StringgetUser()booleanbooleanisDoc()booleanisLogin()booleanisPubsub()booleanresolveParticipant(org.jivesoftware.smack.XMPPConnection connection) If there is no "@" symbol in the participant, find the service domain JID and return the fully qualified JID for the participant as user@server.domainresolveRoom(org.jivesoftware.smack.XMPPConnection connection) voidsetBinding(XmppBinding binding) Sets the binding used to convert from a Camel message to and from an XMPP messagevoidsetConnectionConfig(org.jivesoftware.smack.ConnectionConfiguration connectionConfig) To use an existing connection configuration.voidsetConnectionPollDelay(int connectionPollDelay) The amount of time in seconds between polls (in seconds) to verify the health of the XMPP connection, or between attempts to establish an initial consumer connection.voidsetCreateAccount(boolean createAccount) If true, an attempt to create an account will be made.voidsetDoc(boolean doc) Set a doc header on the IN message containing a Document form of the incoming packet; default is true if presence or pubsub are true, otherwise falsevoidsetHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.voidHostname for the chat servervoidsetLogin(boolean login) Whether to login the user.voidsetNickname(String nickname) Use nickname when joining room.voidsetParticipant(String participant) JID (Jabber ID) of person to receive messages.voidsetPassword(String password) Password for loginvoidsetPort(int port) Port number for the chat servervoidsetPubsub(boolean pubsub) Accept pubsub packets on input, default is falsevoidsetResource(String resource) XMPP resource.voidIf this option is specified, the component will connect to MUC (Multi User Chat).voidsetRoomPassword(String roomPassword) Password for roomvoidsetServiceName(String serviceName) The name of the service you are connecting to.voidsetTestConnectionOnStartup(boolean testConnectionOnStartup) Specifies whether to test the connection on startup.voidUser name (without server name).Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, doInit, doStart, equals, getCamelContext, getComponent, 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, doSuspend, fail, 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.Endpoint
getEndpointBaseUri, isSingletonProducerMethods 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
-
XmppEndpoint
public XmppEndpoint() -
XmppEndpoint
-
-
Method Details
-
createProducer
- Specified by:
createProducerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createGroupChatProducer
public org.apache.camel.Producer createGroupChatProducer() -
createPrivateChatProducer
-
createDirectProducer
public org.apache.camel.Producer createDirectProducer() -
createPubSubProducer
public org.apache.camel.Producer createPubSubProducer() -
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Specified by:
createConsumerin interfaceorg.apache.camel.Endpoint- Throws:
Exception
-
createEndpointUri
- Overrides:
createEndpointUriin classorg.apache.camel.support.DefaultEndpoint
-
createConnection
public org.jivesoftware.smack.tcp.XMPPTCPConnection createConnection() throws InterruptedException, IOException, org.jivesoftware.smack.SmackException, org.jivesoftware.smack.XMPPException- Throws:
InterruptedExceptionIOExceptionorg.jivesoftware.smack.SmackExceptionorg.jivesoftware.smack.XMPPException
-
resolveParticipant
If there is no "@" symbol in the participant, find the service domain JID and return the fully qualified JID for the participant as user@server.domain -
resolveRoom
public String resolveRoom(org.jivesoftware.smack.XMPPConnection connection) throws InterruptedException, org.jivesoftware.smack.SmackException, org.jivesoftware.smack.XMPPException - Throws:
InterruptedExceptionorg.jivesoftware.smack.SmackExceptionorg.jivesoftware.smack.XMPPException
-
getConnectionDescription
-
getConnectionMessage
-
getChatId
-
getBinding
-
setBinding
Sets the binding used to convert from a Camel message to and from an XMPP message -
getHost
-
setHost
Hostname for the chat server -
getPort
public int getPort() -
setPort
public void setPort(int port) Port number for the chat server -
getUser
-
setUser
User name (without server name). If not specified, anonymous login will be attempted. -
getPassword
-
setPassword
Password for login -
getResource
-
setResource
XMPP resource. The default is Camel. -
isLogin
public boolean isLogin() -
setLogin
public void setLogin(boolean login) Whether to login the user. -
isCreateAccount
public boolean isCreateAccount() -
setCreateAccount
public void setCreateAccount(boolean createAccount) If true, an attempt to create an account will be made. Default is false. -
getRoom
-
setRoom
If this option is specified, the component will connect to MUC (Multi User Chat). Usually, the domain name for MUC is different from the login domain. For example, if you are superman@jabber.org and want to join the krypton room, then the room URL is krypton@conference.jabber.org. Note the conference part. It is not a requirement to provide the full room JID. If the room parameter does not contain the @ symbol, the domain part will be discovered and added by Camel -
setRoomPassword
Password for room -
getRoomPassword
-
getParticipant
-
setParticipant
JID (Jabber ID) of person to receive messages. room parameter has precedence over participant. -
getNickname
-
setNickname
Use nickname when joining room. If room is specified and nickname is not, user will be used for the nickname. -
setServiceName
The name of the service you are connecting to. For Google Talk, this would be gmail.com. -
getServiceName
-
getHeaderFilterStrategy
public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()- Specified by:
getHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
setHeaderFilterStrategy
public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.- Specified by:
setHeaderFilterStrategyin interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
getConnectionConfig
public org.jivesoftware.smack.ConnectionConfiguration getConnectionConfig() -
setConnectionConfig
public void setConnectionConfig(org.jivesoftware.smack.ConnectionConfiguration connectionConfig) To use an existing connection configuration. CurrentlyXMPPTCPConnectionConfigurationis only supported (XMPP over TCP). -
isTestConnectionOnStartup
public boolean isTestConnectionOnStartup() -
setTestConnectionOnStartup
public void setTestConnectionOnStartup(boolean testConnectionOnStartup) Specifies whether to test the connection on startup. This is used to ensure that the XMPP client has a valid connection to the XMPP server when the route starts. Camel throws an exception on startup if a connection cannot be established. When this option is set to false, Camel will attempt to establish a "lazy" connection when needed by a producer, and will poll for a consumer connection until the connection is established. Default is true. -
getConnectionPollDelay
public int getConnectionPollDelay() -
setConnectionPollDelay
public void setConnectionPollDelay(int connectionPollDelay) The amount of time in seconds between polls (in seconds) to verify the health of the XMPP connection, or between attempts to establish an initial consumer connection. Camel will try to re-establish a connection if it has become inactive. Default is 10 seconds. -
setPubsub
public void setPubsub(boolean pubsub) Accept pubsub packets on input, default is false -
isPubsub
public boolean isPubsub() -
setDoc
public void setDoc(boolean doc) Set a doc header on the IN message containing a Document form of the incoming packet; default is true if presence or pubsub are true, otherwise false -
isDoc
public boolean isDoc() -
doStop
- Overrides:
doStopin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-