2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.example;
11 import akka.actor.ActorRef;
12 import akka.actor.Props;
13 import akka.actor.UntypedActor;
14 import akka.event.Logging;
15 import akka.event.LoggingAdapter;
16 import org.opendaylight.controller.cluster.example.messages.KeyValue;
17 import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
19 public class ClientActor extends UntypedActor {
20 protected final LoggingAdapter LOG =
21 Logging.getLogger(getContext().system(), this);
23 private final ActorRef target;
25 public ClientActor(ActorRef target){
29 public static Props props(final ActorRef target) {
30 return Props.create(ClientActor.class, target);
33 @Override public void onReceive(Object message) throws Exception {
34 if(message instanceof KeyValue) {
35 target.tell(message, getSelf());
36 } else if(message instanceof KeyValueSaved){
37 LOG.info("KeyValue saved");