Class CamelWebSocketHandler
java.lang.Object
org.apache.camel.component.undertow.handlers.CamelWebSocketHandler
- All Implemented Interfaces:
io.undertow.server.HttpHandler
An
HttpHandler
that delegates to WebSocketProtocolHandshakeHandler
and provides some wiring to
connect UndertowConsumer
with UndertowProducer
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
handleRequest
(io.undertow.server.HttpServerExchange exchange) boolean
send
(Predicate<io.undertow.websockets.core.WebSocketChannel> peerFilter, Object message, int timeout, org.apache.camel.Exchange camelExchange, org.apache.camel.AsyncCallback camelCallback) Send the givenmessage
to one or more channels selected using the givenpeerFilter
within the giventimeout
and report the outcome to the givencamelExchange
andcamelCallback
.void
setConsumer
(UndertowConsumer consumer)
-
Constructor Details
-
CamelWebSocketHandler
public CamelWebSocketHandler()
-
-
Method Details
-
handleRequest
- Specified by:
handleRequest
in interfaceio.undertow.server.HttpHandler
- Throws:
Exception
-
send
public boolean send(Predicate<io.undertow.websockets.core.WebSocketChannel> peerFilter, Object message, int timeout, org.apache.camel.Exchange camelExchange, org.apache.camel.AsyncCallback camelCallback) throws IOException Send the givenmessage
to one or more channels selected using the givenpeerFilter
within the giventimeout
and report the outcome to the givencamelExchange
andcamelCallback
.- Parameters:
peerFilter
- aPredicate
to apply to the set of peers obtained viadelegate
'sWebSocketProtocolHandshakeHandler.getPeerConnections()
message
- the message to sendtimeout
- in millisecondscamelExchange
- to notify about the outcomecamelCallback
- to notify about the outcome- Returns:
true
if the execution finished synchronously orfalse
otherwise- Throws:
IOException
-
setConsumer
- Parameters:
consumer
- theUndertowConsumer
to set
-