Skip to content

Commit 42efbea

Browse files
Vaibhav  BhallaVaibhav  Bhalla
authored andcommitted
gh-3 modify readme
1 parent 777a38a commit 42efbea

File tree

1 file changed

+51
-30
lines changed

1 file changed

+51
-30
lines changed

README.md

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
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+
128
# Message bus queue connectors
229

330
This is the package for the message bus queue connectors component for LoopBack 4 applications.
@@ -12,7 +39,6 @@ Install EventStreamConnectorComponent using `npm`;
1239
```sh
1340
$ [npm install | yarn add] @sourceloop/message-bus-queue-connectors
1441
```
15-
1642
## Flow Diagram
1743

1844
<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
2349
as shown below.
2450

2551
```ts
26-
import {EventStreamConnectorComponent} from '@sourceloop/message-bus-queue-connectors';
52+
import {
53+
EventStreamConnectorComponent
54+
} from '@sourceloop/message-bus-queue-connectors';
2755

2856
// ...
2957
export class MyApplication extends BootMixin(
@@ -46,7 +74,7 @@ To use SQS as their message queue, bind its required config and connector compon
4674
import {
4775
SQSConnector,
4876
SQSBindings,
49-
EventStreamConnectorComponent,
77+
EventStreamConnectorComponent
5078
} from '@sourceloop/message-bus-queue-connectors';
5179

5280
// ...
@@ -155,10 +183,10 @@ const config = {
155183

156184
## Integration
157185

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
159187

160-
```ts
161-
@injectable({scope: BindingScope.TRANSIENT})
188+
```ts
189+
@injectable({scope: BindingScope.TRANSIENT})
162190
export class EventConnector implements IEventConnector<PublishedEvents> {
163191
constructor(
164192
@producer(QueueType.EventBridge)
@@ -170,55 +198,48 @@ export class EventConnector implements IEventConnector<PublishedEvents> {
170198
) {}
171199

172200
// rest of implementation
201+
173202
}
174-
```
203+
```
175204

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.
177206

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>;
188211
};
189-
```
212+
```
190213

191214
It provides '@consumer' decorator to make a service as consumer. consumer needs to follow an interface.
192215

193216
```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>;
201221
}
202222
```
203223

204-
and can be used as
224+
and can be used as
205225

206226
```ts
207227
import {
208228
IConsumer,
209229
QueueType,
210230
consumer,
211231
} from '@sourceloop/message-bus-queue-connectors';
212-
import {OrchestratorStream, EventTypes, ProvisioningInputs} from '../../types';
232+
import { OrchestratorStream, EventTypes, ProvisioningInputs } from '../../types';
213233

214234
@consumer
215235
export class TenantProvisioningConsumerForEventSQS
216236
implements IConsumer<OrchestratorStream, EventTypes.TENANT_PROVISIONING>
217237
{
218-
constructor() {}
238+
constructor(
239+
) {}
219240
event: EventTypes.TENANT_PROVISIONING = EventTypes.TENANT_PROVISIONING;
220241
queue: QueueType = QueueType.SQS;
221-
async handle(data: ProvisioningInputs): Promise<void> {
242+
async handle(data: ProvisioningInputs): Promise<void> {
222243
console.log(`SQS: ${this.event} Event Recieved ` + JSON.stringify(data));
223244
return;
224245
}

0 commit comments

Comments
 (0)