Infront Data Manager Connect Client (.NET)

Create Retransmit Client

A Retransmit Client is the central point where missing updates are downloaded.

To create your onw class(required) follow these steps:

1. Derive your own class from RetransmitClient (Gevasys.DataCore.Client.RetransmitClient )
2. Override the ProcessUpdates method with your custom implementation to process incoming updates (Gevasys.DataCore.Client.RetransmitClient.ProcessUpdates)

Note: Retransmit Client Sample is provided as well in the Data Manager Connect Distributions for Java and .NET. Available online for the closed user group at https://www.vwd.com/ .

using System;
using System.Collections.Generic;
using System.IO;
using Gevasys.DataCore.Client;
using Gevasys.DataCore.Configuration;
using Gevasys.DataCore.Core.Protocol;
using Gevasys.DataCore.Core.Protocol.Binary;
using Gevasys.DataCore.Core.Protocol.Binary.Decoding;
using Gevasys.DataCore.RequestData.ProtoBuf.V2;
using Gevasys.DataCore.RequestData.ProtoBuf.V2.Retransmit;
using Gevasys.DataCore.Tools.Protocol;
namespace Examples
{
class SampleRetransmitClient : RetransmitClient
{
private readonly string _logConfigFilePath = Path.Combine(Environment.CurrentDirectory, "Configuration");
protected ConfigurationHelper configHelper;
private MessageSerializer m_messageSerializer;
long countUpdates;
public SampleRetransmitClient(string name) : base(name)
{
m_messageSerializer = new MessageSerializer();
}
public override void ProcessUpdates(List<UpdateMessage> updates)
{
foreach (UpdateMessage update in updates)
{
switch (update.MessageType)
{
case BaseBinaryMessage.MessageType.Proto:
//Get the Message ID
StringField sf = (StringField)update.GetField(1);
if (sf.Value.Equals(MessageIdentifier.RetransmitStatusMessage))
{
RetransmitStatusMessage statusMessage = ProtobufMessageHelper.DeserializeMessage<RetransmitStatusMessage>(update, ref m_messageSerializer);
if (statusMessage != null)
{
switch (statusMessage.Status)
{
case RetransmitStatusType.RST_COMPLETED:
//Retransmit completed
Console.WriteLine("Retransmit completed");
break;
case RetransmitStatusType.RST_ERROR:
//Retransmit Error
Console.WriteLine("Retransmit Errror");
Console.WriteLine(statusMessage.StatusMessage);
break;
case RetransmitStatusType.RST_OK:
//Retransmit request accepted.
Console.WriteLine("Retransmit accepted");
break;
case RetransmitStatusType.RST_INPROGRESS:
// Retransmit is in progress.
Console.WriteLine("Retransmit in progress");
break;
case RetransmitStatusType.RST_PARAMSERROR:
//Parameter error in retransmit request
Console.WriteLine(statusMessage.StatusMessage);
break;
}
}
}
break;
case BaseBinaryMessage.MessageType.PartialRecap:
case BaseBinaryMessage.MessageType.Recap:
case BaseBinaryMessage.MessageType.Update:
//Process updates
break;
default:
break;
}
//Writes this update to Console in csv format. Attention: Heavy CPU usage!
Console.WriteLine(update.toMachineReadableOutput());
//Logger.Log.Info("Retransmit: " + update.toMachineReadableOutput());
countUpdates++;
if (countUpdates == 1) Console.WriteLine("Retransmit: updates coming in...");
if (countUpdates % 1000 == 0) Console.WriteLine("Retransmit counter: " + countUpdates);
}
}
public void Dispose()
{
throw new NotImplementedException();
}
}
}
Gevasys.DataCore
Definition: BinaryUpstreamClient.cs:5
Gevasys.DataCore.Configuration
Definition: ClassFactory.cs:17
Gevasys.DataCore.Tools
Definition: FieldData.cs:4
Gevasys.DataCore.Client
Definition: BinaryUpstreamClient.cs:5
Gevasys.DataCore.Core.Protocol
Definition: RequestStatusMessage.cs:8
Gevasys
Definition: BinaryUpstreamClient.cs:5
Gevasys.DataCore.Core
Definition: CompressionHelper.cs:7
Examples
Definition: apiinitialize.cs:11
Gevasys.DataCore.Tools.Protocol
Definition: ProtobufMessageHelper.cs:7

Copyright (C) 2021 Infront Financial Technology GmbH
Mainzer Landstrasse 178 – 190
60327 Frankfurt am Main
Infront Data Manager Connect V4.1