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 org.opendaylight.controller.cluster.example.messages.KeyValue;
15 import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 public class ClientActor extends UntypedActor {
20 private static final Logger LOG = LoggerFactory.getLogger(ClientActor.class);
22 private final ActorRef target;
24 public ClientActor(ActorRef target) {
28 public static Props props(final ActorRef target) {
29 return Props.create(ClientActor.class, target);
32 @Override public void onReceive(Object message) {
33 if (message instanceof KeyValue) {
34 target.tell(message, getSelf());
35 } else if (message instanceof KeyValueSaved) {
36 LOG.info("KeyValue saved");