Java Code Examples for org.apache.qpid.proton.engine.Event#getType()
The following examples show how to use
org.apache.qpid.proton.engine.Event#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowController.java From qpid-proton-j with Apache License 2.0 | 6 votes |
@Override public void onUnhandled(Event event) { int window = this.window; Link link = event.getLink(); switch(event.getType()) { case LINK_LOCAL_OPEN: case LINK_REMOTE_OPEN: case LINK_FLOW: case DELIVERY: if (link instanceof Receiver) { this.drained += link.drained(); if (this.drained == 0) { topup((Receiver)link, window); } } break; default: break; } }
Example 2
Source File: NettySimpleAmqpServer.java From qpid-jms with Apache License 2.0 | 5 votes |
private void processProtonEvents() throws Exception { Event event = null; while ((event = eventCollector.peek()) != null) { LOG.trace("Server: Processing event: {}", event.getType()); switch (event.getType()) { case CONNECTION_REMOTE_OPEN: processConnectionOpen(event.getConnection()); break; case CONNECTION_REMOTE_CLOSE: processConnectionClose(event.getConnection()); break; case SESSION_REMOTE_OPEN: processSessionOpen(event.getSession()); break; case SESSION_REMOTE_CLOSE: processSessionClose(event.getSession()); break; case LINK_REMOTE_OPEN: //processLinkOpen(event.getLink()); break; case LINK_REMOTE_DETACH: //processLinkDetach(event.getLink()); break; case LINK_REMOTE_CLOSE: //processLinkClose(event.getLink()); break; case LINK_FLOW: //processLinkFlow(event.getLink()); break; case DELIVERY: //processDelivery(event.getDelivery()); break; default: break; } eventCollector.pop(); } }
Example 3
Source File: IOHandler.java From qpid-proton-j with Apache License 2.0 | 4 votes |
@Override public void onUnhandled(Event event) { try { ReactorImpl reactor = (ReactorImpl)event.getReactor(); Selector selector = reactor.getSelector(); if (selector == null) { selector = new SelectorImpl(reactor.getIO()); reactor.setSelector(selector); } Selectable selectable; switch(event.getType()) { case SELECTABLE_INIT: selectable = event.getSelectable(); selector.add(selectable); break; case SELECTABLE_UPDATED: selectable = event.getSelectable(); selector.update(selectable); break; case SELECTABLE_FINAL: selectable = event.getSelectable(); selector.remove(selectable); selectable.release(); break; case CONNECTION_LOCAL_OPEN: handleOpen(reactor, event); break; case CONNECTION_BOUND: handleBound(reactor, event); break; case TRANSPORT: handleTransport(reactor, event); break; case TRANSPORT_CLOSED: event.getTransport().unbind(); break; case REACTOR_QUIESCED: handleQuiesced(reactor, selector); break; default: break; } } catch(IOException ioException) { // XXX: Might not be the right exception type, but at least the exception isn't being swallowed throw new ReactorInternalException(ioException); } }
Example 4
Source File: AmqpConnection.java From activemq-artemis with Apache License 2.0 | 4 votes |
private void processUpdates() { try { Event protonEvent = null; while ((protonEvent = protonCollector.peek()) != null) { if (!protonEvent.getType().equals(Type.TRANSPORT)) { LOG.trace("Client: New Proton Event: {}", protonEvent.getType()); } AmqpEventSink amqpEventSink = null; switch (protonEvent.getType()) { case CONNECTION_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getConnection().getContext(); amqpEventSink.processRemoteClose(this); break; case CONNECTION_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getConnection().getContext(); amqpEventSink.processRemoteOpen(this); break; case SESSION_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getSession().getContext(); amqpEventSink.processRemoteClose(this); break; case SESSION_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getSession().getContext(); amqpEventSink.processRemoteOpen(this); break; case LINK_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); amqpEventSink.processRemoteClose(this); break; case LINK_REMOTE_DETACH: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); amqpEventSink.processRemoteDetach(this); break; case LINK_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); amqpEventSink.processRemoteOpen(this); break; case LINK_FLOW: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); amqpEventSink.processFlowUpdates(this); break; case DELIVERY: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); amqpEventSink.processDeliveryUpdates(this, (Delivery) protonEvent.getContext()); break; default: break; } protonCollector.pop(); } // We have to do this to pump SASL bytes in as SASL is not event driven yet. if (!authenticated) { processSaslAuthentication(); } } catch (Exception ex) { LOG.warn("Caught Exception during update processing: {}", ex.getMessage(), ex); fireClientException(ex); } }
Example 5
Source File: Events.java From activemq-artemis with Apache License 2.0 | 4 votes |
public static void dispatch(Event event, EventHandler handler) throws Exception { switch (event.getType()) { case CONNECTION_INIT: handler.onInit(event.getConnection()); break; case CONNECTION_LOCAL_OPEN: handler.onLocalOpen(event.getConnection()); break; case CONNECTION_REMOTE_OPEN: handler.onRemoteOpen(event.getConnection()); break; case CONNECTION_LOCAL_CLOSE: handler.onLocalClose(event.getConnection()); break; case CONNECTION_REMOTE_CLOSE: handler.onRemoteClose(event.getConnection()); break; case CONNECTION_FINAL: handler.onFinal(event.getConnection()); break; case SESSION_INIT: handler.onInit(event.getSession()); break; case SESSION_LOCAL_OPEN: handler.onLocalOpen(event.getSession()); break; case SESSION_REMOTE_OPEN: handler.onRemoteOpen(event.getSession()); break; case SESSION_LOCAL_CLOSE: handler.onLocalClose(event.getSession()); break; case SESSION_REMOTE_CLOSE: handler.onRemoteClose(event.getSession()); break; case SESSION_FINAL: handler.onFinal(event.getSession()); break; case LINK_INIT: handler.onInit(event.getLink()); break; case LINK_LOCAL_OPEN: handler.onLocalOpen(event.getLink()); break; case LINK_REMOTE_OPEN: handler.onRemoteOpen(event.getLink()); break; case LINK_LOCAL_CLOSE: handler.onLocalClose(event.getLink()); break; case LINK_REMOTE_CLOSE: handler.onRemoteClose(event.getLink()); break; case LINK_FLOW: handler.onFlow(event.getLink()); break; case LINK_FINAL: handler.onFinal(event.getLink()); break; case LINK_LOCAL_DETACH: handler.onLocalDetach(event.getLink()); break; case LINK_REMOTE_DETACH: handler.onRemoteDetach(event.getLink()); break; case TRANSPORT: handler.onTransport(event.getTransport()); break; case DELIVERY: handler.onDelivery(event.getDelivery()); break; default: break; } }
Example 6
Source File: AmqpProvider.java From qpid-jms with Apache License 2.0 | 4 votes |
private void processUpdates() { try { Event protonEvent = null; while ((protonEvent = protonCollector.peek()) != null) { if (!protonEvent.getType().equals(Type.TRANSPORT)) { LOG.trace("New Proton Event: {}", protonEvent.getType()); } AmqpEventSink amqpEventSink = null; switch (protonEvent.getType()) { case CONNECTION_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getConnection().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteClose(this); } break; case CONNECTION_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getConnection().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteOpen(this); } break; case SESSION_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getSession().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteClose(this); } break; case SESSION_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getSession().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteOpen(this); } break; case LINK_REMOTE_CLOSE: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteClose(this); } break; case LINK_REMOTE_DETACH: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteDetach(this); } break; case LINK_REMOTE_OPEN: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); if (amqpEventSink != null) { amqpEventSink.processRemoteOpen(this); } break; case LINK_FLOW: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); if (amqpEventSink != null) { amqpEventSink.processFlowUpdates(this); } break; case DELIVERY: amqpEventSink = (AmqpEventSink) protonEvent.getLink().getContext(); if (amqpEventSink != null) { amqpEventSink.processDeliveryUpdates(this, (Delivery) protonEvent.getContext()); } break; case TRANSPORT_ERROR: // We handle authentication failure elsewhere, but in doing so we close the transport // head which would also get us here, so only action this if auth succeeded. if (authenticator == null || (authenticator.isComplete() && authenticator.wasSuccessful())) { protonTransportErrorHandled = true; ErrorCondition transportCondition = protonTransport.getCondition(); String message = extractTransportErrorMessage(transportCondition); // Transport has failed, ensure that we see local end of connection as closed // so other shutdown processing doesn't mistakenly assume we can still get a // close from the remote. protonConnection.setCondition(transportCondition); protonConnection.close(); throw new ProviderFailedException(message); } break; default: break; } protonCollector.pop(); } } catch (Throwable t) { try { LOG.warn("Caught problem during update processing: {}", t.getMessage(), t); } finally { fireProviderException(ProviderExceptionSupport.createOrPassthroughFatal(t)); } } }