* 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
26 lines
669 B
C#
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);
|
|
}
|
|
}
|