Created
March 5, 2012 17:18
-
-
Save iocanel/1979570 to your computer and use it in GitHub Desktop.
A karaf command which echos messages to cluster nodes via Hazelcast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Command(scope = "hazelcast", name = "echo", description = "Echos a message to all cluster nodes") | |
public class EchoCommand extends HazelcastCommandSupport { | |
@Argument(index=0,name="message", description = "The message to echo", required = true, multiValued = false) | |
private String message; | |
private ITopic topic; | |
@Override | |
protected Object doExecute() throws Exception { | |
if(topic != null) { | |
topic.publish(message); | |
} else System.err.println("Echo topic not available"); | |
return null; | |
} | |
public ITopic getTopic() { | |
return topic; | |
} | |
public void setTopic(ITopic topic) { | |
this.topic = topic; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment