Class CamelWebSocketHandler
- java.lang.Object
-
- org.apache.camel.component.undertow.handlers.CamelWebSocketHandler
-
- All Implemented Interfaces:
io.undertow.server.HttpHandler
public class CamelWebSocketHandler extends Object implements io.undertow.server.HttpHandler
AnHttpHandler
that delegates toWebSocketProtocolHandshakeHandler
and provides some wiring to connectUndertowConsumer
withUndertowProducer
.
-
-
Constructor Summary
Constructors Constructor Description CamelWebSocketHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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)
-
-
-
Method Detail
-
handleRequest
public void handleRequest(io.undertow.server.HttpServerExchange exchange) throws Exception
- 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 sendcamelExchange
- to notify about the outcomecamelCallback
- to notify about the outcometimeout
- in milliseconds- Returns:
true
if the execution finished synchronously orfalse
otherwise- Throws:
IOException
-
setConsumer
public void setConsumer(UndertowConsumer consumer)
- Parameters:
consumer
- theUndertowConsumer
to set
-
-