StreamLink.NET  7.1.5-7.1.5-3946-4e293d0
 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...

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 Tue Mar 24 2020 11:57:49 for StreamLink.NET