Class AmqpTransporter
java.lang.Object
services.moleculer.service.MoleculerComponent
services.moleculer.transporter.Transporter
services.moleculer.transporter.AmqpTransporter
- All Implemented Interfaces:
MetricConstants, MoleculerLifecycle
AMQP Transporter based on RabbitMQ's AMQP client API. AMQP provides a
platform-agnostic method for ensuring information is safely transported
between applications, among organizations, within mobile infrastructures, and
across the Cloud. Usage:
// https://mvnrepository.com/artifact/com.rabbitmq/amqp-client
compile group: 'com.rabbitmq', name: 'amqp-client', version: '5.8.0'
ServiceBroker broker = ServiceBroker.builder().nodeID("node1").transporter(new AmqpTransporter("localhost")).build();
Required dependency:// https://mvnrepository.com/artifact/com.rabbitmq/amqp-client
compile group: 'com.rabbitmq', name: 'amqp-client', version: '5.8.0'
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.rabbitmq.client.Channelprotected com.rabbitmq.client.Connectionprotected Stringprotected booleanprotected com.rabbitmq.client.ConnectionFactoryprotected booleanprotected booleanprotected booleanprotected com.rabbitmq.client.AMQP.BasicPropertiesprotected Stringprotected com.rabbitmq.client.SslContextFactoryprotected final AtomicBooleanprotected Stringprotected StringFields inherited from class Transporter
checkTimeoutTimer, counterTransporterPacketsReceivedBytes, counterTransporterPacketsReceivedTotal, counterTransporterPacketsSentBytes, counterTransporterPacketsSentTotal, debug, debugHeartbeats, disconnectChannel, discoverBroadcastChannel, discoverChannel, eventbus, eventChannel, executor, gaugeTransitConnected, heartbeatChannel, heartbeatInterval, heartbeatTimeout, heartBeatTimer, infoBroadcastChannel, infoChannel, infoScheduled, infoScheduledAt, instanceID, lastReceivedMessageAt, metrics, monitor, namespace, nodeID, nodes, offlineTimeout, PACKET_DISCONNECT, PACKET_DISCOVER, PACKET_EVENT, PACKET_HEARTBEAT, PACKET_INFO, PACKET_PING, PACKET_PONG, PACKET_REQUEST, PACKET_RESPONSE, pingChannel, pongChannel, preferHostname, prefix, protocolVersion, registry, requestChannel, responseChannel, scheduler, serializer, serviceInvoker, subscriptionTimeout, uidGenerator, usingJsonSerializerFields inherited from class MoleculerComponent
broker, logger, nameFields inherited from interface MetricConstants
MOLECULER_CACHER_CLEAN_TIME, MOLECULER_CACHER_CLEAN_TIME_DESC, MOLECULER_CACHER_CLEAN_TOTAL, MOLECULER_CACHER_CLEAN_TOTAL_DESC, MOLECULER_CACHER_DEL_TIME, MOLECULER_CACHER_DEL_TIME_DESC, MOLECULER_CACHER_DEL_TOTAL, MOLECULER_CACHER_DEL_TOTAL_DESC, MOLECULER_CACHER_EXPIRED_TOTAL, MOLECULER_CACHER_EXPIRED_TOTAL_DESC, MOLECULER_CACHER_FOUND_TOTAL, MOLECULER_CACHER_FOUND_TOTAL_DESC, MOLECULER_CACHER_GET_TIME, MOLECULER_CACHER_GET_TIME_DESC, MOLECULER_CACHER_GET_TOTAL, MOLECULER_CACHER_GET_TOTAL_DESC, MOLECULER_CACHER_SET_TIME, MOLECULER_CACHER_SET_TIME_DESC, MOLECULER_CACHER_SET_TOTAL, MOLECULER_CACHER_SET_TOTAL_DESC, MOLECULER_CIRCUIT_BREAKER_HALF_OPENED_ACTIVE, MOLECULER_CIRCUIT_BREAKER_HALF_OPENED_ACTIVE_DESC, MOLECULER_CIRCUIT_BREAKER_OPENED_ACTIVE, MOLECULER_CIRCUIT_BREAKER_OPENED_ACTIVE_DESC, MOLECULER_CIRCUIT_BREAKER_OPENED_TOTAL, MOLECULER_CIRCUIT_BREAKER_OPENED_TOTAL_DESC, MOLECULER_EVENT_BROADCAST_TOTAL, MOLECULER_EVENT_BROADCAST_TOTAL_DESC, MOLECULER_EVENT_BROADCASTLOCAL_TOTAL, MOLECULER_EVENT_BROADCASTLOCAL_TOTAL_DESC, MOLECULER_EVENT_EMIT_TOTAL, MOLECULER_EVENT_EMIT_TOTAL_DESC, MOLECULER_EVENT_RECEIVED_ACTIVE, MOLECULER_EVENT_RECEIVED_ACTIVE_DESC, MOLECULER_EVENT_RECEIVED_ERROR_TOTAL, MOLECULER_EVENT_RECEIVED_ERROR_TOTAL_DESC, MOLECULER_EVENT_RECEIVED_TIME, MOLECULER_EVENT_RECEIVED_TIME_DESC, MOLECULER_EVENT_RECEIVED_TOTAL, MOLECULER_EVENT_RECEIVED_TOTAL_DESC, MOLECULER_EXECUTOR, MOLECULER_REQUEST_ACTIVE, MOLECULER_REQUEST_ACTIVE_DESC, MOLECULER_REQUEST_ERROR_TOTAL, MOLECULER_REQUEST_ERROR_TOTAL_DESC, MOLECULER_REQUEST_LEVELS, MOLECULER_REQUEST_LEVELS_DESC, MOLECULER_REQUEST_RETRY_ATTEMPTS_TOTAL, MOLECULER_REQUEST_RETRY_ATTEMPTS_TOTAL_DESC, MOLECULER_REQUEST_TIME, MOLECULER_REQUEST_TIME_DESC, MOLECULER_REQUEST_TIMEOUT_TOTAL, MOLECULER_REQUEST_TIMEOUT_TOTAL_DESC, MOLECULER_REQUEST_TOTAL, MOLECULER_REQUEST_TOTAL_DESC, MOLECULER_SCHEDULER, MOLECULER_TRANSIT_CONNECTED, MOLECULER_TRANSIT_CONNECTED_DESC, MOLECULER_TRANSIT_ORPHAN_RESPONSE_TOTAL, MOLECULER_TRANSIT_ORPHAN_RESPONSE_TOTAL_DESC, MOLECULER_TRANSIT_REQUESTS_ACTIVE, MOLECULER_TRANSIT_REQUESTS_ACTIVE_DESC, MOLECULER_TRANSIT_STREAMS_RECEIVE_ACTIVE, MOLECULER_TRANSIT_STREAMS_RECEIVE_ACTIVE_DESC, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_BYTES, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_BYTES_DESC, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_TOTAL, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_TOTAL_DESC, MOLECULER_TRANSPORTER_PACKETS_SENT_BYTES, MOLECULER_TRANSPORTER_PACKETS_SENT_BYTES_DESC, MOLECULER_TRANSPORTER_PACKETS_SENT_TOTAL, MOLECULER_TRANSPORTER_PACKETS_SENT_TOTAL_DESC -
Constructor Summary
ConstructorsConstructorDescriptionAmqpTransporter(String url) AmqpTransporter(String username, String password, com.rabbitmq.client.SslContextFactory sslContextFactory, String url) -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()protected voidprotected voidAny I/O error occurred.com.rabbitmq.client.ConnectionFactorycom.rabbitmq.client.AMQP.BasicPropertiescom.rabbitmq.client.SslContextFactorygetUrl()booleanbooleanbooleanbooleanvoidprotected voidvoidsetExchangeProperties(Map<String, Object> exchangeProperties) voidsetExchangeType(String exchangeType) voidsetExclusive(boolean exclusive) voidsetFactory(com.rabbitmq.client.ConnectionFactory factory) voidsetImmediate(boolean immediate) voidsetInternal(boolean internal) voidsetMandatory(boolean mandatory) voidsetMessageProperties(com.rabbitmq.client.AMQP.BasicProperties messageProperties) voidsetPassword(String password) voidsetQueueProperties(Map<String, Object> queueProperties) voidsetSslContextFactory(com.rabbitmq.client.SslContextFactory sslContextFactory) voidvoidsetUsername(String username) voidstopped()Closes transporter.io.datatree.PromiseMethods inherited from class Transporter
broadcastInfoPacket, broadcastNodeConnected, broadcastNodeDisconnected, broadcastNodeUpdated, broadcastTransporterConnected, broadcastTransporterDisconnected, channel, checkTimeouts, connected, connected, createPingPacket, getAddress, getAllNodeIDs, getCpuUsage, getDescriptor, getHeartbeatInterval, getHeartbeatTimeout, getInstanceID, getLastHeartbeatTime, getNamespace, getOfflineTimeout, getPrefix, getSerializer, getSubscriptionTimeout, isDebug, isDebugHeartbeats, isOnline, isPreferHostname, processReceivedMessage, processReceivedMessage, publish, received, scheduleInfoPacket, sendClosePacket, sendDataPacket, sendDisconnectPacket, sendDiscoverPacket, sendErrorPacket, sendEventPacket, sendHeartbeatPacket, sendInfoPacket, sendPongPacket, sendRequestPacket, setDebug, setDebugHeartbeats, setHeartbeatInterval, setHeartbeatTimeout, setNamespace, setOfflineTimeout, setPreferHostname, setPrefix, setSerializer, setSubscriptionTimeout, started, subscribe, updateNodeInfoMethods inherited from class MoleculerComponent
getBroker, getLogger, getName
-
Field Details
-
username
-
password
-
url
-
sslContextFactory
protected com.rabbitmq.client.SslContextFactory sslContextFactory -
factory
protected com.rabbitmq.client.ConnectionFactory factory -
mandatory
protected boolean mandatory -
immediate
protected boolean immediate -
exclusive
protected boolean exclusive -
internal
protected boolean internal -
exchangeType
-
messageProperties
protected com.rabbitmq.client.AMQP.BasicProperties messageProperties -
queueProperties
-
exchangeProperties
-
client
protected com.rabbitmq.client.Connection client -
channel
protected com.rabbitmq.client.Channel channel -
started
-
-
Constructor Details
-
AmqpTransporter
public AmqpTransporter() -
AmqpTransporter
-
AmqpTransporter
-
-
Method Details
-
connect
public void connect()- Specified by:
connectin classTransporter
-
disconnect
protected void disconnect() -
reconnect
protected void reconnect() -
error
Description copied from class:TransporterAny I/O error occurred. Implementation-specific error handling goes here (reconnection, etc.).- Overrides:
errorin classTransporter- Parameters:
cause- I/O error
-
stopped
public void stopped()Closes transporter.- Specified by:
stoppedin interfaceMoleculerLifecycle- Overrides:
stoppedin classTransporter
-
subscribe
- Specified by:
subscribein classTransporter
-
publish
- Specified by:
publishin classTransporter
-
getUrl
-
setUrl
-
getUsername
-
setUsername
-
getPassword
-
setPassword
-
getFactory
public com.rabbitmq.client.ConnectionFactory getFactory() -
setFactory
public void setFactory(com.rabbitmq.client.ConnectionFactory factory) -
isMandatory
public boolean isMandatory() -
setMandatory
public void setMandatory(boolean mandatory) -
isImmediate
public boolean isImmediate() -
setImmediate
public void setImmediate(boolean immediate) -
getMessageProperties
public com.rabbitmq.client.AMQP.BasicProperties getMessageProperties() -
setMessageProperties
public void setMessageProperties(com.rabbitmq.client.AMQP.BasicProperties messageProperties) -
getSslContextFactory
public com.rabbitmq.client.SslContextFactory getSslContextFactory() -
setSslContextFactory
public void setSslContextFactory(com.rabbitmq.client.SslContextFactory sslContextFactory) -
getExchangeType
-
setExchangeType
-
isExclusive
public boolean isExclusive() -
setExclusive
public void setExclusive(boolean exclusive) -
getQueueProperties
-
setQueueProperties
-
getExchangeProperties
-
setExchangeProperties
-
isInternal
public boolean isInternal() -
setInternal
public void setInternal(boolean internal)
-