StreamLink.NET  8.0.1-8.0.1-1132-88354a9
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Public Member Functions | List of all members
Caplin.StreamLink.ICommandListener Interface Reference

Defines the interface that you should implement to receive information on the result of a command. More...

Inheritance diagram for Caplin.StreamLink.ICommandListener:
Caplin.StreamLink.ICommandResultListener

Public Member Functions

void OnCommandError (string subject, Caplin.StreamLink.ICommandErrorEvent commandErrorEvent)
 Callback invoked when a command failed or is an unknown state. More...
 
void OnCommandOk (string subject)
 Callback invoked when a command was successful. More...
 

Detailed Description

Defines the interface that you should implement to receive information on the result of a command.

For more about commands, see ICommandSubscription.

A trivial implementation would be as follows :

using System;
using Caplin.StreamLink;
using System.Collections.Generic;
namespace Caplin.StreamLink.ExampleSnippets.Listener
{
public class CommandListenerSnippet
{
public CommandListenerSnippet(IStreamLink streamLink)
{
Dictionary<string, string> fieldData = new Dictionary<string, string>();
fieldData.Add("fieldName", "fieldValue");
streamLink.PublishToSubject("/SUBJECT", fieldData, new ExampleCommandListener());
}
class ExampleCommandListener : ICommandListener
{
public void OnCommandOk(string subject)
{
Console.WriteLine("Publish to " + subject + " Successful");
}
public void OnCommandError(string subject, ICommandErrorEvent commandErrorEvent)
{
Console.WriteLine("Publish Error : " + commandErrorEvent.Error);
}
}
}
}

Member Function Documentation

void Caplin.StreamLink.ICommandListener.OnCommandError ( string  subject,
Caplin.StreamLink.ICommandErrorEvent  commandErrorEvent 
)

Callback invoked when a command failed or is an unknown state.

  • Parameters
    subjectThe subject of the command.
  • Parameters
    commandErrorEventInformation about the command error.
void Caplin.StreamLink.ICommandListener.OnCommandOk ( string  subject)

Callback invoked when a command was successful.

  • Parameters
    subjectThe subject of the command.

Generated on Mon Feb 26 2024 19:57:56 for StreamLink.NET