public class AmqpSend
extends org.apache.qpid.proton.engine.BaseHandler
| Modifier and Type | Field and Description |
|---|---|
protected AmqpSendHandler |
amqpSendHandler |
protected String |
hostName |
protected IotHubServiceClientProtocol |
iotHubServiceClientProtocol |
protected org.apache.qpid.proton.reactor.Reactor |
reactor |
protected String |
sasToken |
protected String |
userName |
| Constructor and Description |
|---|
AmqpSend(String hostName,
String userName,
String sasToken,
IotHubServiceClientProtocol iotHubServiceClientProtocol)
Constructor to set up connection parameters
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Invalidate AmqpsSendHandler member variable
|
void |
onReactorInit(org.apache.qpid.proton.engine.Event event)
Event handler for the reactor init event
|
void |
open()
Create AmqpsSendHandler and store it in a member variable
|
void |
send(String deviceId,
Message message)
Create binary message
Initialize and start Proton reactor
Send the created message
|
add, children, getHandler, getHandler, handle, onConnectionBound, onConnectionFinal, onConnectionInit, onConnectionLocalClose, onConnectionLocalOpen, onConnectionRemoteClose, onConnectionRemoteOpen, onConnectionUnbound, onDelivery, onLinkFinal, onLinkFlow, onLinkInit, onLinkLocalClose, onLinkLocalDetach, onLinkLocalOpen, onLinkRemoteClose, onLinkRemoteDetach, onLinkRemoteOpen, onReactorFinal, onReactorQuiesced, onSelectableError, onSelectableExpired, onSelectableFinal, onSelectableInit, onSelectableReadable, onSelectableUpdated, onSelectableWritable, onSessionFinal, onSessionInit, onSessionLocalClose, onSessionLocalOpen, onSessionRemoteClose, onSessionRemoteOpen, onTimerTask, onTransport, onTransportClosed, onTransportError, onTransportHeadClosed, onTransportTailClosed, onUnhandled, setHandler, setHandlerprotected final String hostName
protected final String userName
protected final String sasToken
protected org.apache.qpid.proton.reactor.Reactor reactor
protected AmqpSendHandler amqpSendHandler
protected IotHubServiceClientProtocol iotHubServiceClientProtocol
public AmqpSend(String hostName, String userName, String sasToken, IotHubServiceClientProtocol iotHubServiceClientProtocol)
hostName - The address string of the service (example: AAA.BBB.CCC)userName - The username string to use SASL authentication (example: user@sas.service)sasToken - The SAS token stringiotHubServiceClientProtocol - protocol to usepublic void onReactorInit(org.apache.qpid.proton.engine.Event event)
onReactorInit in interface org.apache.qpid.proton.engine.CoreHandleronReactorInit in class org.apache.qpid.proton.engine.BaseHandlerevent - The proton event objectpublic void open()
public void close()
public void send(String deviceId, Message message) throws IOException, IotHubException
deviceId - The device name stringmessage - The message to be sentIOException - This exception is thrown if the AmqpSend object is not initializedIotHubException - If IotHub rejects the message for any reasonCopyright © 2017. All rights reserved.