Package org.openremote.manager.mqtt
Class MQTTBrokerService
java.lang.Object
org.apache.camel.builder.BuilderSupport
org.apache.camel.builder.RouteBuilder
org.openremote.manager.mqtt.MQTTBrokerService
- All Implemented Interfaces:
org.apache.activemq.artemis.core.server.plugin.ActiveMQServerBasePlugin,org.apache.activemq.artemis.core.server.plugin.ActiveMQServerConnectionPlugin,org.apache.activemq.artemis.core.server.plugin.ActiveMQServerSessionPlugin,org.apache.camel.builder.ModelRoutesBuilder,org.apache.camel.CamelContextAware,org.apache.camel.Ordered,org.apache.camel.RoutesBuilder,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.ResourceAware,org.openremote.model.ContainerService
public class MQTTBrokerService
extends org.apache.camel.builder.RouteBuilder
implements org.openremote.model.ContainerService, org.apache.activemq.artemis.core.server.plugin.ActiveMQServerConnectionPlugin, org.apache.activemq.artemis.core.server.plugin.ActiveMQServerSessionPlugin
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanstatic final Stringprotected AssetProcessingServiceprotected AssetStorageServiceprotected AuthorisationServiceprotected ClientEventServiceprotected ConcurrentMap<String, org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> protected ConcurrentMap<String, org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> protected List<MQTTHandler> protected com.google.common.cache.Cache<String, org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> protected ExecutorServiceprotected Stringprotected ManagerKeycloakIdentityProviderprotected static final System.Loggerprotected org.openremote.container.message.MessageBrokerServicestatic final Stringstatic intstatic final Stringstatic final Stringprotected intstatic final intprotected ActiveMQORSecurityManagerprotected org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQprotected org.apache.activemq.artemis.core.config.Configurationprotected org.apache.activemq.artemis.api.core.client.ServerLocatorprotected org.apache.activemq.artemis.api.core.client.ClientSessionFactoryprotected org.openremote.container.timer.TimerServiceprotected org.openremote.model.util.Debouncer<String> protected ConcurrentMap<String, List<org.openremote.model.PersistenceEvent<org.openremote.model.asset.UserAssetLink>>> protected final org.apache.activemq.artemis.core.config.WildcardConfigurationFields inherited from class org.apache.camel.builder.RouteBuilder
logFields inherited from interface org.openremote.model.ContainerService
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITYFields inherited from interface org.apache.camel.Ordered
HIGHEST, LOWEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCreateConnection(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) voidafterCreateSession(org.apache.activemq.artemis.core.server.ServerSession session) voidafterDestroyConnection(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) voidauthenticateConnection(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection, String realm, String username, String password) voidstatic StringconnectionToString(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) protected org.apache.activemq.artemis.api.core.client.ClientSessionCreate a client session for communicating with the brokerbooleandisconnectSession(String connectionID) protected voiddoForceDisconnect(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) org.apache.activemq.artemis.spi.core.protocol.RemotingConnectiongetConnectionFromClientID(String clientID) static StringgetConnectionIDString(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) intprotected org.apache.activemq.artemis.core.config.WildcardConfigurationstatic StringgetSubjectName(Subject subject) Set<org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> getUserConnections(String userID) Get active connections for the specified user IDorg.apache.activemq.artemis.core.config.WildcardConfigurationvoidinit(org.openremote.model.Container container) protected voidnotifyConnectionAuthenticated(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) voidonSubscribe(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection, String topicStr) voidonUnsubscribe(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection, String topicStr) voidprocessUserAssetLinkChange(String userID, List<org.openremote.model.PersistenceEvent<org.openremote.model.asset.UserAssetLink>> changes) voidstart(org.openremote.model.Container container) voidstop(org.openremote.model.Container container) Methods inherited from class org.apache.camel.builder.RouteBuilder
addLifecycleInterceptor, addRoutes, addRoutesToCamelContext, addTemplatedRoutesToCamelContext, bindToRegistry, bindToRegistry, checkInitialized, configuration, configureRest, configureRests, configureRoute, configureRouteConfiguration, configureRoutes, configureRouteTemplate, configureTemplatedRoute, customize, customize, dataFormat, errorHandler, errorHandler, expression, from, from, from, fromF, fromV, fromV, getBeans, getOrder, getResource, getRestCollection, getRestConfiguration, getRests, getRouteCollection, getRoutes, getRouteTemplateCollection, getTemplatedRouteCollection, initializeCamelContext, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, loadRoutesBuilder, loadRoutesBuilder, onCompletion, onException, onException, populateBeans, populateOrUpdateRoutes, populateRests, populateRoutes, populateRouteTemplates, populateTemplatedRoutes, populateTransformers, populateValidators, prepareModel, property, propertyInject, removeLifecycleInterceptor, rest, rest, restConfiguration, routeTemplate, setErrorHandlerFactory, setResource, setRestCollection, setRouteTemplateCollection, setTemplatedRouteCollection, templatedRoute, tokenizer, toString, transformer, updateRoutesToCamelContext, validatorMethods inherited from class org.apache.camel.builder.BuilderSupport
body, bodyAs, constant, constant, constant, createErrorHandlerBuilder, csimple, csimple, datasonnet, datasonnet, datasonnet, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, exceptionMessage, exchangeProperty, expression, getCamelContext, getContext, getErrorHandlerFactory, hasErrorHandlerFactory, header, java, java, joor, joor, jq, jq, jsonpath, jsonpath, jtaTransactionErrorHandler, jtaTransactionErrorHandler, jtaTransactionErrorHandler, method, method, method, method, noErrorHandler, regexReplaceAll, regexReplaceAll, setCamelContext, simple, simple, simpleF, simpleF, springTransactionErrorHandler, springTransactionErrorHandler, springTransactionErrorHandler, systemProperty, systemProperty, variable, xpath, xpath, xpath, xpathMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.plugin.ActiveMQServerBasePlugin
init, registered, setInit, unregisteredMethods inherited from interface org.apache.activemq.artemis.core.server.plugin.ActiveMQServerSessionPlugin
afterCloseSession, afterSessionMetadataAdded, beforeCloseSession, beforeCreateSession, beforeSessionMetadataAdded, duplicateSessionMetadataFailure
-
Field Details
-
MQTT_FORCE_USER_DISCONNECT_DEBOUNCE_MILLIS
- See Also:
-
MQTT_FORCE_USER_DISCONNECT_DEBOUNCE_MILLIS_DEFAULT
public static int MQTT_FORCE_USER_DISCONNECT_DEBOUNCE_MILLIS_DEFAULT -
PRIORITY
public static final int PRIORITY- See Also:
-
MQTT_SERVER_LISTEN_HOST
- See Also:
-
MQTT_SERVER_LISTEN_PORT
- See Also:
-
ANONYMOUS_USERNAME
- See Also:
-
wildcardConfiguration
protected final org.apache.activemq.artemis.core.config.WildcardConfiguration wildcardConfiguration -
LOG
-
assetStorageService
-
authorisationService
-
identityProvider
-
clientEventService
-
messageBrokerService
protected org.openremote.container.message.MessageBrokerService messageBrokerService -
executorService
-
timerService
protected org.openremote.container.timer.TimerService timerService -
assetProcessingService
-
customHandlers
-
clientIDConnectionMap
protected ConcurrentMap<String,org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> clientIDConnectionMap -
connectionIDConnectionMap
protected ConcurrentMap<String,org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> connectionIDConnectionMap -
userAssetLinkChangeMap
protected ConcurrentMap<String,List<org.openremote.model.PersistenceEvent<org.openremote.model.asset.UserAssetLink>>> userAssetLinkChangeMap -
userAssetDisconnectDebouncer
-
disconnectedConnectionCache
protected com.google.common.cache.Cache<String,org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> disconnectedConnectionCache -
active
protected boolean active -
host
-
port
protected int port -
serverConfiguration
protected org.apache.activemq.artemis.core.config.Configuration serverConfiguration -
server
protected org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ server -
securityManager
-
serverLocator
protected org.apache.activemq.artemis.api.core.client.ServerLocator serverLocator -
sessionFactory
protected org.apache.activemq.artemis.api.core.client.ClientSessionFactory sessionFactory
-
-
Constructor Details
-
MQTTBrokerService
public MQTTBrokerService()
-
-
Method Details
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceorg.openremote.model.ContainerService
-
init
- Specified by:
initin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
start
- Specified by:
startin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
configure
- Specified by:
configurein classorg.apache.camel.builder.RouteBuilder- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
afterCreateConnection
public void afterCreateConnection(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) throws org.apache.activemq.artemis.api.core.ActiveMQException - Specified by:
afterCreateConnectionin interfaceorg.apache.activemq.artemis.core.server.plugin.ActiveMQServerConnectionPlugin- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
afterCreateSession
public void afterCreateSession(org.apache.activemq.artemis.core.server.ServerSession session) throws org.apache.activemq.artemis.api.core.ActiveMQException - Specified by:
afterCreateSessionin interfaceorg.apache.activemq.artemis.core.server.plugin.ActiveMQServerSessionPlugin- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
afterDestroyConnection
public void afterDestroyConnection(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) throws org.apache.activemq.artemis.api.core.ActiveMQException - Specified by:
afterDestroyConnectionin interfaceorg.apache.activemq.artemis.core.server.plugin.ActiveMQServerConnectionPlugin- Throws:
org.apache.activemq.artemis.api.core.ActiveMQException
-
onSubscribe
public void onSubscribe(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection, String topicStr) -
onUnsubscribe
public void onUnsubscribe(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection, String topicStr) -
getCustomHandlers
-
processUserAssetLinkChange
-
getUserConnections
public Set<org.apache.activemq.artemis.spi.core.protocol.RemotingConnection> getUserConnections(String userID) Get active connections for the specified user ID -
doForceDisconnect
protected void doForceDisconnect(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) -
disconnectSession
-
getWildcardConfiguration
public org.apache.activemq.artemis.core.config.WildcardConfiguration getWildcardConfiguration() -
getConnectionIDString
public static String getConnectionIDString(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) -
connectionToString
public static String connectionToString(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) -
getSubjectName
-
getConnectionFromClientID
public org.apache.activemq.artemis.spi.core.protocol.RemotingConnection getConnectionFromClientID(String clientID) -
notifyConnectionAuthenticated
protected void notifyConnectionAuthenticated(org.apache.activemq.artemis.spi.core.protocol.RemotingConnection connection) -
createSession
protected org.apache.activemq.artemis.api.core.client.ClientSession createSession() throws ExceptionCreate a client session for communicating with the broker- Throws:
Exception
-
getServerWildcardConfiguration
protected org.apache.activemq.artemis.core.config.WildcardConfiguration getServerWildcardConfiguration() -
authenticateConnection
-