elsa-workflows / elsa-workflows/elsa-core
ServiceBus Sharing
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## Summary
In an application that already uses the Rebus ServiceBus, is it possible to configure Elsa to use the same bus?
## Motivation
1. Resource usage: There is a processing cost to each instance of a Rebus ServiceBus - especially when a database transport is used (such as Postgres) as results in a connection for every instance
2. Interoperability with Elsa: The ability to have a Rebus messages sent outside of an Elsa workflow trigger an Elsa workflow
## Initial Attempt (and Difficulty)
One option would perhaps be to provide a custom IServiceBusFactory implementation. However the DI configuration in Elsa seems to lock in the concrete ServiceBusFactory class:
```c#
// File: ElsaServiceCollectionExtensions.cs
// Method: AddWorkflowsCore
// Service Bus.
services
.AddSingleton()
.AddSingleton(sp => sp.GetRequiredService())
```
## Questions
1. Is there some existing way that an existing Rebus instance can be used with Elsa?
2. If not: is this a capability that could be easily added (I'd be happy to have a go at submitting a pull request, but need some pointers about how to go about it)
Thanks
Contributor guide
Assessment
This issue has not been assessed yet.