akka.cluster.ClusterEvent.MemberRemoved Java Examples
The following examples show how to use
akka.cluster.ClusterEvent.MemberRemoved.
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: AkkaClusterListener.java From servicecomb-pack with Apache License 2.0 | 6 votes |
@Override public Receive createReceive() { return receiveBuilder() .match(MemberUp.class, mUp -> { LOG.info("Member is Up: {}", mUp.member()); }) .match(UnreachableMember.class, mUnreachable -> { LOG.info("Member detected as unreachable: {}", mUnreachable.member()); }) .match(MemberRemoved.class, mRemoved -> { LOG.info("Member is Removed: {}", mRemoved.member()); }) .match(MemberEvent.class, message -> { // ignore }) .matchAny(msg -> AKKA_LOG.warning("Received unknown message: {}", msg)) .build(); }
Example #2
Source File: SimpleClusterListener.java From akka-kubernetes-example with Apache License 2.0 | 6 votes |
@Override public void onReceive(Object message) { if (message instanceof MemberUp) { MemberUp mUp = (MemberUp) message; log.info("Member is Up: {}", mUp.member()); } else if (message instanceof UnreachableMember) { UnreachableMember mUnreachable = (UnreachableMember) message; log.info("Member detected as unreachable: {}", mUnreachable.member()); } else if (message instanceof MemberRemoved) { MemberRemoved mRemoved = (MemberRemoved) message; log.info("Member is Removed: {}", mRemoved.member()); } else if (message instanceof MemberEvent) { // ignore } else { unhandled(message); } }
Example #3
Source File: ClusterListener.java From flux with Apache License 2.0 | 6 votes |
/** * Overridden super class method. Receives callback messages for cluster membership changes. * Updates list of current cluster member addresses based on these updates * @see akka.actor.UntypedActor#onReceive(java.lang.Object) */ public void onReceive(Object message) { if (message instanceof MemberUp) { MemberUp mUp = (MemberUp) message; logger.info("Cluster Member is Up: " + mUp.member()); memberAddresses.add(mUp.member().address()); } else if (message instanceof UnreachableMember) { UnreachableMember mUnreachable = (UnreachableMember) message; logger.info("Cluster Member detected as unreachable " + mUnreachable.member()); } else if (message instanceof MemberRemoved) { MemberRemoved mRemoved = (MemberRemoved) message; logger.info("Cluster Member is Removed: " + mRemoved.member()); memberAddresses.remove(mRemoved.member().address()); } else if (message instanceof MemberEvent) { // ignore } else { unhandled(message); } }
Example #4
Source File: ClusterListener.java From akka-tutorial with Apache License 2.0 | 5 votes |
@Override public Receive createReceive() { return receiveBuilder().match(CurrentClusterState.class, state -> { this.log.info("Current members: {}", state.members()); }).match(MemberUp.class, mUp -> { this.log.info("Member is Up: {}", mUp.member()); }).match(UnreachableMember.class, mUnreachable -> { this.log.info("Member detected as unreachable: {}", mUnreachable.member()); }).match(MemberRemoved.class, mRemoved -> { this.log.info("Member is Removed: {}", mRemoved.member()); }).match(MemberEvent.class, message -> { // ignore }).build(); }
Example #5
Source File: Worker.java From akka-tutorial with Apache License 2.0 | 5 votes |
@Override public Receive createReceive() { return receiveBuilder() .match(CurrentClusterState.class, this::handle) .match(MemberUp.class, this::handle) .match(MemberRemoved.class, this::handle) .matchAny(object -> this.log().info("Received unknown message: \"{}\"", object.toString())) .build(); }
Example #6
Source File: ClusterListener.java From akka-tutorial with Apache License 2.0 | 5 votes |
@Override public Receive createReceive() { return receiveBuilder().match(CurrentClusterState.class, state -> { this.log.info("Current members: {}", state.members()); }).match(MemberUp.class, mUp -> { this.log.info("Member is Up: {}", mUp.member()); }).match(UnreachableMember.class, mUnreachable -> { this.log.info("Member detected as unreachable: {}", mUnreachable.member()); }).match(MemberRemoved.class, mRemoved -> { this.log.info("Member is Removed: {}", mRemoved.member()); }).match(MemberEvent.class, message -> { // ignore }).build(); }
Example #7
Source File: Worker.java From akka-tutorial with Apache License 2.0 | 5 votes |
@Override public Receive createReceive() { return receiveBuilder() .match(CurrentClusterState.class, this::handle) .match(MemberUp.class, this::handle) .match(MemberRemoved.class, this::handle) .match(Object.class, this::handle) .matchAny(object -> this.log().info("Received unknown message: \"{}\"", object.toString())) .build(); }
Example #8
Source File: Worker.java From akka-tutorial with Apache License 2.0 | 4 votes |
@Override public void preStart() { Reaper.watchWithDefaultReaper(this); this.cluster.subscribe(this.self(), MemberUp.class, MemberRemoved.class); }
Example #9
Source File: Worker.java From akka-tutorial with Apache License 2.0 | 4 votes |
private void handle(MemberRemoved message) { if (this.masterSystem.equals(message.member())) this.self().tell(PoisonPill.getInstance(), ActorRef.noSender()); }
Example #10
Source File: Worker.java From akka-tutorial with Apache License 2.0 | 4 votes |
@Override public void preStart() { Reaper.watchWithDefaultReaper(this); this.cluster.subscribe(this.self(), MemberUp.class, MemberRemoved.class); }
Example #11
Source File: Worker.java From akka-tutorial with Apache License 2.0 | 4 votes |
private void handle(MemberRemoved message) { if (this.masterSystem.equals(message.member())) this.self().tell(PoisonPill.getInstance(), ActorRef.noSender()); }