mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:26:31 +00:00
62623b7123
rewrite zmq to DEALER and ROUTER add GET_USER command to get CurrentUser from Python all auth is on the python side inference run and validate annotations on python
16 lines
452 B
C#
16 lines
452 B
C#
using MessagePack;
|
|
using NetMQ;
|
|
using NetMQ.Sockets;
|
|
|
|
namespace Azaion.CommonSecurity;
|
|
|
|
public static class ZeroMqExtensions
|
|
{
|
|
public static T? Get<T>(this DealerSocket dealer, out byte[] message)
|
|
{
|
|
if (!dealer.TryReceiveFrameBytes(TimeSpan.FromMinutes(2), out var bytes))
|
|
throw new Exception($"Unable to get {typeof(T).Name}");
|
|
message = bytes;
|
|
return MessagePackSerializer.Deserialize<T>(bytes);
|
|
}
|
|
} |