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.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.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.XMPPTCPConnection
org.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
protected String
org.apache.camel.Producer
org.apache.camel.Producer
createPrivateChatProducer
(String participant) org.apache.camel.Producer
org.apache.camel.Producer
protected void
doStop()
org.jivesoftware.smack.ConnectionConfiguration
static String
getConnectionMessage
(org.jivesoftware.smack.XMPPConnection connection) int
org.apache.camel.spi.HeaderFilterStrategy
getHost()
int
getPort()
getRoom()
protected String
getUser()
boolean
boolean
isDoc()
boolean
isLogin()
boolean
isPubsub()
boolean
resolveParticipant
(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 [email protected]resolveRoom
(org.jivesoftware.smack.XMPPConnection connection) void
setBinding
(XmppBinding binding) Sets the binding used to convert from a Camel message to and from an XMPP messagevoid
setConnectionConfig
(org.jivesoftware.smack.ConnectionConfiguration connectionConfig) To use an existing connection configuration.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.void
setCreateAccount
(boolean createAccount) If true, an attempt to create an account will be made.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 falsevoid
setHeaderFilterStrategy
(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom HeaderFilterStrategy to filter header to and from Camel message.void
Hostname for the chat servervoid
setLogin
(boolean login) Whether to login the user.void
setNickname
(String nickname) Use nickname when joining room.void
setParticipant
(String participant) JID (Jabber ID) of person to receive messages.void
setPassword
(String password) Password for loginvoid
setPort
(int port) Port number for the chat servervoid
setPubsub
(boolean pubsub) Accept pubsub packets on input, default is falsevoid
setResource
(String resource) XMPP resource.void
If this option is specified, the component will connect to MUC (Multi User Chat).void
setRoomPassword
(String roomPassword) Password for roomvoid
setServiceName
(String serviceName) The name of the service you are connecting to.void
setTestConnectionOnStartup
(boolean testConnectionOnStartup) Specifies whether to test the connection on startup.void
User name (without server name).Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, doInit, 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, toString
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, 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
-
XmppEndpoint
public XmppEndpoint() -
XmppEndpoint
-
-
Method Details
-
createProducer
- Specified by:
createProducer
in 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:
createConsumer
in interfaceorg.apache.camel.Endpoint
- Throws:
Exception
-
createEndpointUri
- Overrides:
createEndpointUri
in 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:
InterruptedException
IOException
org.jivesoftware.smack.SmackException
org.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 [email protected] -
resolveRoom
public String resolveRoom(org.jivesoftware.smack.XMPPConnection connection) throws InterruptedException, org.jivesoftware.smack.SmackException, org.jivesoftware.smack.XMPPException - Throws:
InterruptedException
org.jivesoftware.smack.SmackException
org.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 [email protected] and want to join the krypton room, then the room URL is [email protected]. 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:
getHeaderFilterStrategy
in 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:
setHeaderFilterStrategy
in 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. CurrentlyXMPPTCPConnectionConfiguration
is 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:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-