public AkkaEventsHandlerAndNotifierActor(final EventsHandler eventsHandler, final String writeConsistency, final int writeConsistencyTimeoutInSeconds) { this.eventsHandler = eventsHandler; this.instanceSenderId = self().toString(); this.writeConsistency = instantiateWriteConsistency(writeConsistency, writeConsistencyTimeoutInSeconds); }
/** * Executes an operation on a local actor and wait for it's response * * @param actor * @param message * @return The response of the operation */ public Object executeOperation(ActorRef actor, Object message) { Future<Object> future = executeOperationAsync(actor, message, operationTimeout); try { return Await.result(future, operationDuration); } catch (Exception e) { throw new TimeoutException("Sending message " + message.getClass().toString() + " to actor " + actor.toString() + " failed. Try again later.", e); } }
public ProjectionError(ProjectionFailedError error) { this.event = error.getMessage().toString(); this.projection = error.getProjection().toString(); if (error.getMessage() instanceof Event) { try { this.date = format.format(((Event) error.getMessage()).getCreated().toDate()); } catch (Exception e) { log.warn("Could not format created date", e); } } reason = joinStackTrace(error.getReason()); }
public AkkaEventsHandlerAndNotifier() { Config akkaConfig = AkkaUtils.getAkkaConfiguration("events.conf"); eventsSystem = ActorSystem.create(EVENTS_SYSTEM, akkaConfig); List<Address> seedNodesAddresses = getSeedNodesAddresses(); if (seedNodesAddresses.isEmpty()) { LOGGER.warn( "Found no seed nodes addresses (in any source, i.e., 1) system properties; 2) env. variables; 3) properties files)"); } Cluster.get(eventsSystem).joinSeedNodes(seedNodesAddresses); eventsNotifierAndHandlerActor = instantiateEventsNotifierAndHandlerActor(); instanceSenderId = eventsNotifierAndHandlerActor.toString(); }
/** * remove remote channel and communicator which belongs to the controller * which connected with the remote channel * * @param remoteChannel * remote channel * @param communicator * communicator */ public void removeMountedDevice(UscRemoteChannelIdentifier remoteChannel, ActorRef communicator) { deviceTable.removeEntry(remoteChannel, communicator.toString()); // send channel connection exception to all related local session localSessionManager.removeAll(remoteChannel); monitor.onEvent(new UscChannelCloseEvent(remoteChannel.getIp(), remoteChannel.getRemoteChannelType())); LOG.info("Remove remote channel {}", remoteChannel); }
protected void dispatch(Object msg, ActorRef sender, ActorRef target) { boolean telling = false; if (LOGGER.isDebugEnabled()) { LOGGER.debug("Dispatch message class {} from actor {} to actor Ref {}.", msg.getClass().getCanonicalName(), sender.toString(), target.toString()); LOGGER.debug("TELL following message to actor {} : {}", target.toString(), msg); target.forward(msg, getContext()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("FORWARDING following message to actor {} : {}", target.toString(), msg);