Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added interface for rabbitmq eventbus #21630

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
{
context
.ServiceProvider
.GetRequiredService<RabbitMqDistributedEventBus>()
.GetRequiredService<IRabbitMqDistributedEventBus>()
.Initialize();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Volo.Abp.EventBus.Distributed;

namespace Volo.Abp.EventBus.RabbitMq;

public interface IRabbitMqDistributedEventBus : IDistributedEventBus
{
void Initialize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace Volo.Abp.EventBus.RabbitMq;
/* TODO: How to handle unsubscribe to unbind on RabbitMq (may not be possible for)
*/
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IDistributedEventBus), typeof(RabbitMqDistributedEventBus))]
public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDependency
[ExposeServices(typeof(IDistributedEventBus), typeof(RabbitMqDistributedEventBus), typeof(IRabbitMqDistributedEventBus))]
public class RabbitMqDistributedEventBus : DistributedEventBusBase, IRabbitMqDistributedEventBus, ISingletonDependency
{
protected AbpRabbitMqEventBusOptions AbpRabbitMqEventBusOptions { get; }
protected IConnectionPool ConnectionPool { get; }
Expand Down Expand Up @@ -72,7 +72,7 @@ public RabbitMqDistributedEventBus(
EventTypes = new ConcurrentDictionary<string, Type>();
}

public void Initialize()
public virtual void Initialize()
{
Consumer = MessageConsumerFactory.Create(
new ExchangeDeclareConfiguration(
Expand Down Expand Up @@ -290,7 +290,7 @@ public virtual Task PublishAsync(
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
var body = Serializer.Serialize(eventData);

return PublishAsync( eventName, body, headersArguments, eventId, correlationId);
return PublishAsync(eventName, body, headersArguments, eventId, correlationId);
}

protected virtual Task PublishAsync(
Expand Down
Loading