Interface CommandListener
-
- All Known Subinterfaces:
CommandResultListener
public interface CommandListener
Defines the interface that you should implement to receive information on the result of a command.
For more about commands, see
CommandSubscription
.A trivial implementation would be as follows :
import java.util.HashMap; import java.util.Map; import com.caplin.streamlink.CommandErrorEvent; import com.caplin.streamlink.CommandListener; import com.caplin.streamlink.StreamLink; public class CommandListenerSnippet { public CommandListenerSnippet(StreamLink streamLink) { Map
fieldData = new HashMap (); fieldData.put("fieldName", "fieldValue"); streamLink.publishToSubject("/SUBJECT", fieldData, new CommandListener() { public void onCommandOk(String subject) { System.out.println("Publish to " + subject + " Succesful"); } public void onCommandError(String subject, CommandErrorEvent commandErrorEvent) { System.out.println("Publish Error : " + commandErrorEvent.getError()); } }); } }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onCommandError(java.lang.String subject, CommandErrorEvent commandErrorEvent)
Callback invoked when a command failed or is an unknown state.void
onCommandOk(java.lang.String subject)
Callback invoked when a command was successful.
-
-
-
Method Detail
-
onCommandOk
void onCommandOk(java.lang.String subject)
Callback invoked when a command was successful.
- Parameters:
subject
- The subject of the command.
-
onCommandError
void onCommandError(java.lang.String subject, CommandErrorEvent commandErrorEvent)
Callback invoked when a command failed or is an unknown state.
- Parameters:
subject
- The subject of the command.commandErrorEvent
- Information about the command error.
-
-