Class AmqpWSTransport
- java.lang.Object
-
- org.apache.activemq.util.ServiceSupport
-
- org.apache.activemq.transport.TransportSupport
-
- org.apache.activemq.transport.amqp.AmqpWSTransport
-
- All Implemented Interfaces:
Service,AmqpFrameParser.AMQPFrameSink,Transport,WSTransport
public class AmqpWSTransport extends TransportSupport implements WSTransport, AmqpFrameParser.AMQPFrameSink
An AMQP based WebSocket transport implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.activemq.transport.ws.WSTransport
WSTransport.WSTransportSink
-
-
Constructor Summary
Constructors Constructor Description AmqpWSTransport(URI location, WireFormat wireFormat)Create a new Transport instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoStart()protected voiddoStop(ServiceStopper stopper)intgetMaxFrameSize()X509Certificate[]getPeerCertificates()intgetReceiveCounter()Returns a counter which gets incremented as data is read from the transport.StringgetRemoteAddress()StringgetSubProtocol()WireFormatgetWireFormat()Retrieves the WireFormat instance associated with this Transport instance.voidoneway(Object command)A one way asynchronous sendvoidonFrame(Object frame)voidonWebSocketBinary(ByteBuffer data)Called from the WebSocket framework when new incoming Binary data is received.voidonWebSocketClosed()Called from the WebSocket framework when the socket has been closed unexpectedly.voidonWebSocketText(String data)Called from the WebSocket framework when new incoming String data is received.voidsetPeerCertificates(X509Certificate[] certificates)Sets the certificates provided by the connected peer.voidsetTransportSink(WSTransport.WSTransportSink outputSink)Called to provide the WS with the output data sink.-
Methods inherited from class org.apache.activemq.transport.TransportSupport
asyncRequest, checkStarted, doConsume, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, onException, reconnect, request, request, setTransportListener, updateURIs
-
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.transport.Transport
asyncRequest, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, reconnect, request, request, setTransportListener, updateURIs
-
-
-
-
Constructor Detail
-
AmqpWSTransport
public AmqpWSTransport(URI location, WireFormat wireFormat)
Create a new Transport instance.- Parameters:
location- the remote location where the client connection is from.wireFormat- the WireFormat instance that configures this Transport.
-
-
Method Detail
-
setTransportSink
public void setTransportSink(WSTransport.WSTransportSink outputSink)
Description copied from interface:WSTransportCalled to provide the WS with the output data sink.- Specified by:
setTransportSinkin interfaceWSTransport
-
oneway
public void oneway(Object command) throws IOException
Description copied from interface:TransportA one way asynchronous send- Specified by:
onewayin interfaceTransport- Throws:
IOException
-
getRemoteAddress
public String getRemoteAddress()
- Specified by:
getRemoteAddressin interfaceTransport- Returns:
- the remote address for this connection
-
getReceiveCounter
public int getReceiveCounter()
Description copied from interface:TransportReturns a counter which gets incremented as data is read from the transport. It should only be used to determine if there is progress being made in reading the next command from the transport. The value may wrap into the negative numbers.- Specified by:
getReceiveCounterin interfaceTransport- Returns:
- a counter which gets incremented as data is read from the transport.
-
getPeerCertificates
public X509Certificate[] getPeerCertificates()
- Specified by:
getPeerCertificatesin interfaceTransport- Returns:
- the Certificates provided by the peer, or null if not a secure channel.
-
setPeerCertificates
public void setPeerCertificates(X509Certificate[] certificates)
Description copied from interface:TransportSets the certificates provided by the connected peer.- Specified by:
setPeerCertificatesin interfaceTransport- Parameters:
certificates- the Certificates provided by the peer.
-
getSubProtocol
public String getSubProtocol()
- Specified by:
getSubProtocolin interfaceWSTransport- Returns:
- the WS sub-protocol that this transport is supplying.
-
getWireFormat
public WireFormat getWireFormat()
Description copied from interface:TransportRetrieves the WireFormat instance associated with this Transport instance.- Specified by:
getWireFormatin interfaceTransport- Returns:
- the WireFormat in use.
-
getMaxFrameSize
public int getMaxFrameSize()
- Specified by:
getMaxFrameSizein interfaceWSTransport- Returns:
- the maximum frame size allowed for this WS Transport.
-
doStop
protected void doStop(ServiceStopper stopper) throws Exception
- Specified by:
doStopin classServiceSupport- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Specified by:
doStartin classServiceSupport- Throws:
Exception
-
onWebSocketText
public void onWebSocketText(String data) throws IOException
Description copied from interface:WSTransportCalled from the WebSocket framework when new incoming String data is received.- Specified by:
onWebSocketTextin interfaceWSTransport- Parameters:
data- The newly received incoming data.- Throws:
IOException- if an error occurs or the socket doesn't support text data.
-
onWebSocketBinary
public void onWebSocketBinary(ByteBuffer data) throws IOException
Description copied from interface:WSTransportCalled from the WebSocket framework when new incoming Binary data is received.- Specified by:
onWebSocketBinaryin interfaceWSTransport- Parameters:
data- The newly received incoming data.- Throws:
IOException- if an error occurs or the socket doesn't support binary data.
-
onWebSocketClosed
public void onWebSocketClosed() throws IOExceptionDescription copied from interface:WSTransportCalled from the WebSocket framework when the socket has been closed unexpectedly.- Specified by:
onWebSocketClosedin interfaceWSTransport- Throws:
IOException- if an error while processing the close.
-
onFrame
public void onFrame(Object frame)
- Specified by:
onFramein interfaceAmqpFrameParser.AMQPFrameSink
-
-