public interface MessagingAccessPoint
MessagingAccessPoint
may be obtained from OMS
, which is capable of creating Producer
, Consumer
, ResourceManager
, and other facility entities.
For example:
MessagingAccessPoint messagingAccessPoint = OMS.getMessagingAccessPoint("oms:rocketmq://alice@rocketmq.apache.org/us-east:default_space"); messagingAccessPoint.startup(); Producer producer = messagingAccessPoint.createProducer(); producer.startup(); producer.send(producer.createBytesMessage("HELLO_QUEUE", "HELLO_BODY".getBytes(Charset.forName("UTF-8"))));
Modifier and Type | Method and Description |
---|---|
KeyValue |
attributes()
Returns the attributes of this
MessagingAccessPoint instance. |
Producer |
createProducer()
Creates a new
Producer for the specified MessagingAccessPoint . |
Producer |
createProducer(TransactionStateCheckListener transactionStateCheckListener)
Creates a new transactional
Producer for the specified MessagingAccessPoint , the producer is able
to respond to requests from the server to check the status of the transaction. |
PullConsumer |
createPullConsumer()
Creates a new
PullConsumer for the specified MessagingAccessPoint . |
PullConsumer |
createPullConsumer(KeyValue attributes)
Creates a new
PullConsumer for the specified MessagingAccessPoint . |
PushConsumer |
createPushConsumer()
Creates a new
PushConsumer for the specified MessagingAccessPoint . |
PushConsumer |
createPushConsumer(KeyValue attributes)
Creates a new
PushConsumer for the specified MessagingAccessPoint with some preset attributes. |
MessageFactory |
messageFactory()
Gets a
MessageFactory instance from the specified MessagingAccessPoint . |
ResourceManager |
resourceManager()
Gets a lightweight
ResourceManager instance from the specified MessagingAccessPoint . |
String |
version()
Returns the target OMS specification version of the specified vendor implementation.
|
String version()
OMS.specVersion
KeyValue attributes()
MessagingAccessPoint
instance.
There are some standard attributes defined by OMS for MessagingAccessPoint
:
OMSBuiltinKeys.ACCESS_POINTS
, the specified access points.
OMSBuiltinKeys.DRIVER_IMPL
, the fully qualified class name of the specified MessagingAccessPoint's
implementation, the default value is io.openmessaging.<driver_type>.MessagingAccessPointImpl.
OMSBuiltinKeys.REGION
, the region the resources reside in.
OMSBuiltinKeys.ACCOUNT_ID
, the ID of the specific account system that owns the resource.
Producer createProducer()
Producer
for the specified MessagingAccessPoint
.Producer
OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request due to some internal
errorOMSSecurityException
- if have no authority to create a producer.Producer createProducer(TransactionStateCheckListener transactionStateCheckListener)
Producer
for the specified MessagingAccessPoint
, the producer is able
to respond to requests from the server to check the status of the transaction.transactionStateCheckListener
- transactional check listener TransactionStateCheckListener
Producer
OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request due to some internal
errorOMSSecurityException
- if have no authority to create a producer.PushConsumer createPushConsumer()
PushConsumer
for the specified MessagingAccessPoint
.
The returned PushConsumer
isn't attached to any queue,
uses PushConsumer.bindQueue(Collection, MessageListener)
to attach queues.PushConsumer
OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request
due to some internal errorPullConsumer createPullConsumer()
PullConsumer
for the specified MessagingAccessPoint
.PullConsumer
OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request
due to some internal errorPushConsumer createPushConsumer(KeyValue attributes)
PushConsumer
for the specified MessagingAccessPoint
with some preset attributes.attributes
- the preset attributesPushConsumer
OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request
due to some internal errorPullConsumer createPullConsumer(KeyValue attributes)
PullConsumer
for the specified MessagingAccessPoint
.PullConsumer
OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request
due to some internal errorResourceManager resourceManager()
ResourceManager
instance from the specified MessagingAccessPoint
.OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request due to some internal
errorOMSSecurityException
- if have no authority to obtain a resource manager.MessageFactory messageFactory()
MessageFactory
instance from the specified MessagingAccessPoint
.OMSRuntimeException
- if the MessagingAccessPoint
fails to handle this request due to some internal
errorCopyright © 2017–2020 OpenMessaging. All rights reserved.