1
+ <p align =" center " >
2
+ <a href =" https://sourcefuse.github.io/arc-docs/arc-api-docs " target =" blank " ><img src =" https://github.com/sourcefuse/loopback4-microservice-catalog/blob/master/docs/assets/logo-dark-bg.png?raw=true " width =" 180 " alt =" ARC Logo " /></a >
3
+ </p >
4
+
5
+ ARC by SourceFuse is an open-source Rapid Application Development framework for developing cloud-native enterprise applications, utilizing prebuilt microservices and standardized architectures for deployment on private and public clouds.
6
+ </p >
7
+
8
+ <p align =" center " >
9
+ <a href =" https://sonarcloud.io/summary/new_code?id=sourcefuse_loopback4-message-bus-queue-connector " target =" _blank " >
10
+ <img alt =" Sonar Quality Gate " src =" https://img.shields.io/sonar/quality_gate/sourcefuse_loopback4-s3?server=https%3A%2F%2Fsonarcloud.io " >
11
+ </a >
12
+ <a href =" https://app.snyk.io/org/ashishkaushik/reporting?context[page]=issues-detail&project_target=%255B%2522sourcefuse%252Floopback4-message-bus-queue-connector%2522%255D&project_origin=%255B%2522github%2522%255D&issue_status=%255B%2522Open%2522%255D&issue_by=Severity&table_issues_detail_cols=SEVERITY%257CSCORE%257CCVE%257CCWE%257CPROJECT%257CEXPLOIT%2520MATURITY%257CCOMPUTED%2520FIXABILITY%257CINTRODUCED%257CSNYK%2520PRODUCT&tableRowsPerPage=10&v=1&table_issues_detail_sort=SCORE%2520DESC " >
13
+ <img alt =" Synk Status " src =" https://img.shields.io/badge/SYNK_SECURITY-MONITORED-GREEN " >
14
+ </a >
15
+ <a href =" https://github.com/sourcefuse/loopback4-message-bus-queue-connector/graphs/contributors " target =" _blank " >
16
+ <img alt =" GitHub contributors " src =" https://img.shields.io/github/contributors/sourcefuse/loopback4-s3 " >
17
+ </a >
18
+ <a href =" https://www.npmjs.com/package/loopback4-message-bus-queue-connector " target =" _blank " >
19
+ <img alt =" downloads " src =" https://img.shields.io/npm/dw/loopback4-s3.svg " >
20
+ </a >
21
+ <a href =" https://github.com/sourcefuse/loopback4-message-bus-queue-connector/blob/master/LICENSE " >
22
+ <img src =" https://img.shields.io/github/license/sourcefuse/loopback4-s3.svg " alt =" License " />
23
+ </a >
24
+ <a href =" https://loopback.io/ " target =" _blank " >
25
+ <img alt =" Powered By LoopBack 4 " src =" https://img.shields.io/badge/Powered%20by-LoopBack 4-brightgreen " />
26
+ </a >
27
+
1
28
# Message bus queue connectors
2
29
3
30
This is the package for the message bus queue connectors component for LoopBack 4 applications.
@@ -12,7 +39,6 @@ Install EventStreamConnectorComponent using `npm`;
12
39
``` sh
13
40
$ [npm install | yarn add] @sourceloop/message-bus-queue-connectors
14
41
```
15
-
16
42
## Flow Diagram
17
43
18
44
<img width =" 659 " alt =" Screenshot 2025-06-06 at 10 53 06 AM " src =" https://github.com/user-attachments/assets/baf1bcaa-5f67-44bb-a01a-b8d1c41644bc " />
@@ -23,7 +49,9 @@ Configure and load EventStreamConnectorComponent in the application constructor
23
49
as shown below.
24
50
25
51
``` ts
26
- import {EventStreamConnectorComponent } from ' @sourceloop/message-bus-queue-connectors' ;
52
+ import {
53
+ EventStreamConnectorComponent
54
+ } from ' @sourceloop/message-bus-queue-connectors' ;
27
55
28
56
// ...
29
57
export class MyApplication extends BootMixin (
@@ -46,7 +74,7 @@ To use SQS as their message queue, bind its required config and connector compon
46
74
import {
47
75
SQSConnector ,
48
76
SQSBindings ,
49
- EventStreamConnectorComponent ,
77
+ EventStreamConnectorComponent
50
78
} from ' @sourceloop/message-bus-queue-connectors' ;
51
79
52
80
// ...
@@ -155,10 +183,10 @@ const config = {
155
183
156
184
## Integration
157
185
158
- @sourceloop/message-bus-queue-connectors provides a decorator '@producer ()' that can be used to access the producer of each msg queue. It expects one arguement defining the type of queue, of which producer u want to use. like
186
+ @sourceloop/message-bus-queue-connectors provides a decorator '@producer ()' that can be used to access the producer of each msg queue. It expects one arguement defining the type of queue, of which producer u want to use. like
159
187
160
- ``` ts
161
- @injectable ({scope: BindingScope .TRANSIENT })
188
+ ``` ts
189
+ @injectable ({scope: BindingScope .TRANSIENT })
162
190
export class EventConnector implements IEventConnector <PublishedEvents > {
163
191
constructor (
164
192
@producer (QueueType .EventBridge )
@@ -170,55 +198,48 @@ export class EventConnector implements IEventConnector<PublishedEvents> {
170
198
) {}
171
199
172
200
// rest of implementation
201
+
173
202
}
174
- ```
203
+ ```
175
204
176
- Producer provider two ways of sending events - single event at a time and multiple event at a time.
205
+ Producer provider two ways of sending events - single event at a time and multiple event at a time.
177
206
178
- ``` ts
179
- export type Producer <Stream extends AnyObject = AnyObject > = {
180
- send: <Event extends keyof Stream >(
181
- data : Stream [Event ],
182
- topic ? : Event ,
183
- ) => Promise <void >;
184
- sendMultiple: <Event extends keyof Stream >(
185
- data : Stream [Event ][],
186
- topic ? : Event ,
187
- ) => Promise <void >;
207
+ ``` ts
208
+ export type Producer <Stream extends AnyObject = AnyObject > = {
209
+ send: <Event extends keyof Stream >(data : Stream [Event ], topic ? : Event ) => Promise <void >;
210
+ sendMultiple: <Event extends keyof Stream >(data : Stream [Event ][], topic ? : Event ) => Promise <void >;
188
211
};
189
- ```
212
+ ```
190
213
191
214
It provides '@consumer ' decorator to make a service as consumer. consumer needs to follow an interface.
192
215
193
216
``` ts
194
- export interface IConsumer <
195
- Stream extends AnyObject ,
196
- Event extends keyof Stream ,
197
- > {
198
- event: Event ;
199
- queue: QueueType ;
200
- handle(data : Stream [Event ]): Promise <void >;
217
+ export interface IConsumer <Stream extends AnyObject , Event extends keyof Stream > {
218
+ event: Event ;
219
+ queue: QueueType ;
220
+ handle(data : Stream [Event ]): Promise <void >;
201
221
}
202
222
```
203
223
204
- and can be used as
224
+ and can be used as
205
225
206
226
``` ts
207
227
import {
208
228
IConsumer ,
209
229
QueueType ,
210
230
consumer ,
211
231
} from ' @sourceloop/message-bus-queue-connectors' ;
212
- import {OrchestratorStream , EventTypes , ProvisioningInputs } from ' ../../types' ;
232
+ import { OrchestratorStream , EventTypes , ProvisioningInputs } from ' ../../types' ;
213
233
214
234
@consumer
215
235
export class TenantProvisioningConsumerForEventSQS
216
236
implements IConsumer <OrchestratorStream , EventTypes .TENANT_PROVISIONING >
217
237
{
218
- constructor () {}
238
+ constructor (
239
+ ) {}
219
240
event: EventTypes .TENANT_PROVISIONING = EventTypes .TENANT_PROVISIONING ;
220
241
queue: QueueType = QueueType .SQS ;
221
- async handle(data : ProvisioningInputs ): Promise <void > {
242
+ async handle(data : ProvisioningInputs ): Promise <void > {
222
243
console .log (` SQS: ${this .event } Event Recieved ` + JSON .stringify (data ));
223
244
return ;
224
245
}
0 commit comments