add supports for ZeroMQ, XRabbitMQ, XKafka ...
This commit is contained in:
@@ -19,6 +19,7 @@ namespace xEventService.Providers
|
||||
/// </summary>
|
||||
public abstract class XRabbitMQConsumerServiceBase : XBaseEventConsumerBackgroundService
|
||||
{
|
||||
//
|
||||
protected IModel channel;
|
||||
protected IConnection connection;
|
||||
protected AsyncEventingBasicConsumer consumer;
|
||||
@@ -79,7 +80,11 @@ namespace xEventService.Providers
|
||||
var body = ea.Body.ToArray();
|
||||
var json = Encoding.UTF8.GetString(body);
|
||||
var message = json.FromJSON<XEventMessage>();
|
||||
if (!message.IsNullOrDefault())
|
||||
if (!message.IsNullOrDefault() &&
|
||||
message.IsValid(
|
||||
allowedSenders: allowedSenders,
|
||||
allowedActions: allowedActions)
|
||||
)
|
||||
{
|
||||
//
|
||||
await DoWorkAsync(
|
||||
@@ -163,8 +168,18 @@ namespace xEventService.Providers
|
||||
public override void Dispose()
|
||||
{
|
||||
//
|
||||
channel.Dispose();
|
||||
connection.Dispose();
|
||||
if (channel != null)
|
||||
{
|
||||
channel.Dispose();
|
||||
}
|
||||
|
||||
//
|
||||
if (connection != null)
|
||||
{
|
||||
connection.Dispose();
|
||||
}
|
||||
|
||||
//
|
||||
GC.SuppressFinalize(this);
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user