Comparing version 6.1.3-otel.0 to 6.2.0
@@ -132,3 +132,5 @@ import { HTTPOptions } from 'aws-sdk'; | ||
producer: any; | ||
publish(payload: T | T[]): Promise<void>; | ||
publish(payload: T | T[], context?: { | ||
key: string; | ||
}): Promise<void>; | ||
} | ||
@@ -135,0 +137,0 @@ export interface IRunner<T = any, M = any> { |
@@ -15,3 +15,3 @@ import { Steveo } from '..'; | ||
get registry(): import("../common").IRegistry; | ||
get wrap(): (context: import("..").MiddlewareContext, next: import("../common").MiddlewareCallback) => any; | ||
get wrap(): (context: import("../common").MiddlewareContext, next: import("../common").MiddlewareCallback) => any; | ||
getActiveSubsciptions(topics?: string[]): string[]; | ||
@@ -18,0 +18,0 @@ healthCheck(): Promise<void>; |
import { Manager } from './lib/manager'; | ||
import { IRunner, ITask, Callback, Pool, Logger, ISteveo, IRegistry, IProducer, IEvent, KafkaConfiguration, RedisConfiguration, SQSConfiguration, DummyConfiguration, Middleware, TaskOptions } from './common'; | ||
export { KafkaConfiguration, RedisConfiguration, SQSConfiguration, DummyConfiguration, MiddlewareContext, } from './common'; | ||
export { Middleware, Logger }; | ||
export { KafkaConfiguration, RedisConfiguration, SQSConfiguration, DummyConfiguration, } from './common'; | ||
export { Middleware }; | ||
export declare class Steveo implements ISteveo { | ||
@@ -6,0 +6,0 @@ config: KafkaConfiguration | RedisConfiguration | SQSConfiguration; |
@@ -82,5 +82,11 @@ "use strict"; | ||
async stop() { | ||
this.producer.disconnect(); | ||
if (this.producer.isConnected()) { | ||
this.producer.disconnect(err => { | ||
if (err) { | ||
this.logger.error('Error while disconnecting producer', err); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
exports.default = KafkaProducer; |
@@ -11,4 +11,6 @@ import { ITask, KafkaConfiguration, RedisConfiguration, SQSConfiguration, DummyConfiguration, Callback, TaskOptions, IProducer, IRegistry } from './common'; | ||
constructor(config: KafkaConfiguration | RedisConfiguration | SQSConfiguration | DummyConfiguration, registry: IRegistry, producer: IProducer, name: string, topic: string, subscribe: Callback<T, R>, options?: TaskOptions); | ||
publish(payload: T | T[]): Promise<void>; | ||
publish(payload: T | T[], context?: { | ||
key: string; | ||
}): Promise<void>; | ||
} | ||
export default Task; |
@@ -13,3 +13,3 @@ "use strict"; | ||
} | ||
async publish(payload) { | ||
async publish(payload, context) { | ||
let params; | ||
@@ -27,3 +27,3 @@ if (!Array.isArray(payload)) { | ||
this.registry.emit('task_send', this.topic, data); | ||
return this.producer.send(this.topic, data); | ||
return this.producer.send(this.topic, data, context === null || context === void 0 ? void 0 : context.key); | ||
})); | ||
@@ -30,0 +30,0 @@ this.registry.emit('task_success', this.topic, payload); |
{ | ||
"name": "steveo", | ||
"version": "6.1.3-otel.0", | ||
"version": "6.2.0", | ||
"description": "A Task Pub/Sub Background processing library", | ||
@@ -60,8 +60,8 @@ "main": "lib/index.js", | ||
"@ordermentum/eslint-config-ordermentum": "2.0.0-rc2", | ||
"@types/chai": "4.3.11", | ||
"@types/generic-pool": "3.1.11", | ||
"@types/chai": "4.3.16", | ||
"@types/generic-pool": "3.8.1", | ||
"@types/lodash.merge": "4.6.9", | ||
"@types/mocha": "10.0.1", | ||
"@types/newrelic": "9.14.3", | ||
"@types/node": "16.18.69", | ||
"@types/node": "16.18.97", | ||
"@types/rsmq": "0.8.4", | ||
@@ -73,5 +73,5 @@ "@types/sinon": "10.0.20", | ||
"aws-sdk": "^2.1043.0", | ||
"chai": "4.3.10", | ||
"chai": "4.4.1", | ||
"cross-env": "7.0.3", | ||
"eslint": "8.32.0", | ||
"eslint": "8.57.0", | ||
"eslint-config-airbnb": "19.0.4", | ||
@@ -78,0 +78,0 @@ "eslint-config-airbnb-base": "15.0.0", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
87012
2080
1
0