Skip to content

Commit 4d67b21

Browse files
committed
Format code
1 parent a7f4c9e commit 4d67b21

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/init.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Attributes, Validator } from 'validator-x';
66
import { ApplicationContext } from './context';
77
import { HealthController } from './controllers/HealthController';
88
import { User } from './models/User';
9-
import { ActiveMQSender, ActiveMQSubscriber, Config } from './services/activemq';
9+
import { ActiveMQSubscriber, ActiveMQWriter, Config } from './services/activemq';
1010
import { ActiveMQChecker } from './services/activemq';
1111

1212
const retries = [5000, 10000, 20000];
@@ -36,16 +36,16 @@ const user: Attributes = {
3636

3737
export function createContext(db: Db, client: Client, config: Config): ApplicationContext {
3838
const atmqChecker = new ActiveMQChecker(config);
39-
const healthController = new HealthController([atmqChecker]);
40-
const writer = new MongoInserter(db.collection('users'), 'id');
41-
const retryWriter = new RetryWriter(writer.write, retries, writeUser, log);
39+
const health = new HealthController([atmqChecker]);
40+
const dbwriter = new MongoInserter(db.collection('users'), 'id');
41+
const retryWriter = new RetryWriter(dbwriter.write, retries, writeUser, log);
4242
const errorHandler = new ErrorHandler(log);
4343
const validator = new Validator<User>(user, true);
44-
const consumer = new ActiveMQSubscriber<User>(client, config.destinationName, config.subscriptionName, 'client-individual', true, undefined, undefined, log, log);
45-
const producer = new ActiveMQSender<User>(client, config.destinationName, config.subscriptionName);
46-
const retryService = new RetryService<User, boolean>(producer.produce, log, log);
44+
const subscriber = new ActiveMQSubscriber<User>(client, config.destinationName, config.subscriptionName, 'client-individual', true, undefined, undefined, log, log);
45+
const writer = new ActiveMQWriter<User>(client, config.destinationName, config.subscriptionName);
46+
const retryService = new RetryService<User, boolean>(writer.write, log, log);
4747
const handler = new Handler<User, boolean>(retryWriter.write, validator.validate, retries, errorHandler.error, log, log, retryService.retry, 3, 'retry');
48-
const ctx: ApplicationContext = { handle: handler.handle, read: consumer.consume, health: healthController };
48+
const ctx: ApplicationContext = { handle: handler.handle, read: subscriber.subscribe, health };
4949
return ctx;
5050
}
5151

src/services/activemq/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export * from './config';
22
export * from './checker';
33
export * from './connection';
44
export * from './subscriber';
5-
export * from './sender';
5+
export * from './writer';

src/services/activemq/subscriber.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export class ActiveMQSubscriber<T> {
2626
} else {
2727
this.retryCountName = retryCountName;
2828
}
29-
this.consume = this.consume.bind(this);
29+
this.subscribe = this.subscribe.bind(this);
3030
}
3131

32-
consume(handle: (data: T, attributes?: StringMap) => Promise<number>): void {
32+
subscribe(handle: (data: T, attributes?: StringMap) => Promise<number>): void {
3333
const prefix = this.prefix && this.prefix.length > 0 ? this.prefix : '/';
3434
const subscribeHeaders = {
3535
'destination': `${this.destinationName}${prefix}${this.subscriptionName}`,

src/services/activemq/sender.ts renamed to src/services/activemq/writer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { StringMap } from 'mq-one';
22
import Client = require('stompit/lib/Client');
33
import { Message } from './message';
44

5-
export class ActiveMQSender<T> {
5+
export class ActiveMQWriter<T> {
66
constructor(
77
private client: Client,
88
private destinationName: string,
@@ -11,10 +11,10 @@ export class ActiveMQSender<T> {
1111
private prefix?: string,
1212
private log?: (msg: any) => void
1313
) {
14-
this.produce = this.produce.bind(this);
14+
this.write = this.write.bind(this);
1515
}
1616

17-
produce(data: T, attributes?: StringMap): Promise<boolean> {
17+
write(data: T, attributes?: StringMap): Promise<boolean> {
1818
const prefix = this.prefix && this.prefix.length > 0 ? this.prefix : '/';
1919
const sendHeaders = {
2020
'destination': `${this.destinationName}${prefix}${this.subscriptionName}`,

0 commit comments

Comments
 (0)