Class UndertowConsumer
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultConsumer
org.apache.camel.component.undertow.UndertowConsumer
- All Implemented Interfaces:
io.undertow.server.HttpHandler,AutoCloseable,org.apache.camel.Consumer,org.apache.camel.EndpointAware,org.apache.camel.health.HealthCheckAware,org.apache.camel.RouteAware,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.RouteIdAware,org.apache.camel.StatefulService,org.apache.camel.Suspendable,org.apache.camel.SuspendableService
public class UndertowConsumer
extends org.apache.camel.support.DefaultConsumer
implements io.undertow.server.HttpHandler, org.apache.camel.Suspendable
The Undertow consumer which is also an Undertow HttpHandler implementation to handle incoming request.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionUndertowConsumer(UndertowEndpoint endpoint, org.apache.camel.Processor processor) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoResume()protected voiddoStart()protected voiddoStop()protected voidvoidhandleRequest(io.undertow.server.HttpServerExchange httpExchange) booleanisRest()booleanvoidsendEventNotification(String connectionKey, io.undertow.websockets.spi.WebSocketHttpExchange transportExchange, io.undertow.websockets.core.WebSocketChannel channel, UndertowConstants.EventType eventType) Send a notification related a WebSocket peer.voidsendMessage(String connectionKey, io.undertow.websockets.core.WebSocketChannel channel, Object message) Create anExchangefrom the associatedUndertowEndpointand set theinMessage's body to the givenmessageandUndertowConstants.CONNECTION_KEYheader to the givenconnectionKey.voidsetRest(boolean rest) Methods inherited from class org.apache.camel.support.DefaultConsumer
createExchange, createUoW, defaultConsumerCallback, doBuild, doInit, doneUoW, doShutdown, getAsyncProcessor, getExceptionHandler, getHealthCheck, getProcessor, getRoute, getRouteId, handleException, handleException, handleException, releaseExchange, setExceptionHandler, setHealthCheck, setRoute, setRouteId, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
resume, suspend
-
Constructor Details
-
UndertowConsumer
-
-
Method Details
-
isRest
public boolean isRest() -
setRest
public void setRest(boolean rest) -
getEndpoint
- Specified by:
getEndpointin interfaceorg.apache.camel.EndpointAware- Overrides:
getEndpointin classorg.apache.camel.support.DefaultConsumer
-
computeAllowedRoles
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
doSuspend
- Overrides:
doSuspendin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doResume
- Overrides:
doResumein classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
isSuspended
public boolean isSuspended()- Specified by:
isSuspendedin interfaceorg.apache.camel.SuspendableService- Overrides:
isSuspendedin classorg.apache.camel.support.service.BaseService
-
handleRequest
- Specified by:
handleRequestin interfaceio.undertow.server.HttpHandler- Throws:
Exception
-
sendMessage
public void sendMessage(String connectionKey, io.undertow.websockets.core.WebSocketChannel channel, Object message) Create anExchangefrom the associatedUndertowEndpointand set theinMessage's body to the givenmessageandUndertowConstants.CONNECTION_KEYheader to the givenconnectionKey.- Parameters:
connectionKey- an identifier ofWebSocketChannelthrough which themessagewas receivedchannel- theWebSocketChannelthrough which themessagewas receivedmessage- the message received via theWebSocketChannel
-
sendEventNotification
public void sendEventNotification(String connectionKey, io.undertow.websockets.spi.WebSocketHttpExchange transportExchange, io.undertow.websockets.core.WebSocketChannel channel, UndertowConstants.EventType eventType) Send a notification related a WebSocket peer.- Parameters:
connectionKey- of WebSocket peertransportExchange- the exchange for the websocket transport, only available for ON_OPEN eventschannel- theWebSocketChannelthrough which themessagewas receivedeventType- the type of the event
-