Files
spark/src/DataStreamSuite/PubSub/Server/InternalPublisher.cs
T
John Colvin c5f4d146f3 refactor: Add PubSub service modules for Dependency Injection
* Get rid of JsonPropertyName attributes in PubSubConfig
  - The Dependency Injection framework (based around dotnet ApplicationBuilder)
    does not support this attribute, and maps property names verbatim to json fields.

* Change PubSubServer json fields to match cs class property names verbatim
2025-11-30 16:44:31 +00:00

26 lines
669 B
C#

namespace Bts.PubSub.Server;
using bts;
using System.Threading;
/// <summary>
/// A simple queue based implementation of <see cref="IInternalPublisher"/>.
/// </summary>
class InternalPublisher : IInternalPublisher {
static int instanceCounter = 0;
readonly IInternalPublisherQueue queue;
public InternalPublisher(IInternalPublisherQueue queue) {
Log.assert(Interlocked.Increment(ref instanceCounter) == 1);
this.queue = queue;
}
public void Publish(PublishMsg message) {
Log.Gen.diag($"InternalPublisher.Publish message: {message}");
Log.assert(!string.IsNullOrEmpty(message.tag));
queue.Enqueue(message);
}
}