public void exceptionOccurred(Exception exception) { // Todo: fail fast components? StringWriter sw = new StringWriter(); exception.printStackTrace(new PrintWriter(sw)); getComponent().getLogger().severe("Exception during stream processing\n"+sw); } });
/** * Send a message. * @param me The message content (name value pairs). * @param mt The message type describing the content. */ public IFuture<Void> sendMessage(Map<String, Object> me, MessageType mt) { return sendMessage(me, mt, null); }
/** * Inform the component that a stream has arrived. * @param con The stream that arrived. */ public void streamArrived(IConnection con) { getComponent().getComponentFeature(IExecutionFeature.class) .scheduleStep(createHandleStreamStep(con)) .addResultListener(new IResultListener<Void>() { public void resultAvailable(Void result) { // NOP } public void exceptionOccurred(Exception exception) { // Todo: fail fast components? StringWriter sw = new StringWriter(); exception.printStackTrace(new PrintWriter(sw)); getComponent().getLogger().severe("Exception during stream processing\n"+sw); } }); }
/** * Inform the component that a message has arrived. * @param message The message that arrived. */ public void messageArrived(IMessageAdapter message) { getComponent().getComponentFeature(IExecutionFeature.class) .scheduleStep(createHandleMessageStep(message)) .addResultListener(new IResultListener<Void>() { public void resultAvailable(Void result) { // NOP } public void exceptionOccurred(Exception exception) { if(!(exception instanceof ComponentTerminatedException) || !((ComponentTerminatedException)exception).getComponentIdentifier().equals(component.getComponentIdentifier())) { // Todo: fail fast components? StringWriter sw = new StringWriter(); exception.printStackTrace(new PrintWriter(sw)); getComponent().getLogger().severe("Exception during message processing\n"+sw); } } }); }
throw new RuntimeException("Message has no conversation identifier set: "+me); addMessageHandler(new IMessageHandler() return sendMessage(me, mt);
public IFuture<Void> execute(IInternalAccess ia) { // Only call timeout when handler is still present if(messagehandlers.contains(handler)) { handler.timeoutOccurred(); if(handler.isRemove()) { removeMessageHandler(handler); } } return IFuture.DONE; } }, handler.isRealtime());
public void exceptionOccurred(Exception exception) { if(!(exception instanceof ComponentTerminatedException) || !((ComponentTerminatedException)exception).getComponentIdentifier().equals(component.getComponentIdentifier())) { // Todo: fail fast components? StringWriter sw = new StringWriter(); exception.printStackTrace(new PrintWriter(sw)); getComponent().getLogger().severe("Exception during message processing\n"+sw); } } });
IMessageService ms = SServiceProvider.getLocalService(getComponent(), IMessageService.class, RequiredServiceInfo.SCOPE_PLATFORM); IFuture<Void> res = ms.sendMessage(me, mt, getComponent().getComponentIdentifier(), getComponent().getModel().getResourceIdentifier(), null, codecids); res.addResultListener(getComponent().getComponentFeature(IExecutionFeature.class).createResultListener(new DelegationResultListener<Void>(ret)));
getComponent().getComponentFeature(IExecutionFeature.class).waitForDelay(handler.getTimeout(), new IComponentStep<Void>()