@spinajs/queue
Advanced tools
Comparing version 2.0.199 to 2.0.200
@@ -50,3 +50,3 @@ import { AsyncService, Constructor, IInstanceCheck, IMappableService } from '@spinajs/di'; | ||
CreatedAt: DateTime; | ||
Name: string; | ||
get Name(): string; | ||
Type: QueueMessageType; | ||
@@ -53,0 +53,0 @@ Persistent: boolean; |
@@ -57,2 +57,8 @@ "use strict"; | ||
class QueueMessage { | ||
// event name | ||
// defaults to class name | ||
get Name() { | ||
// default name is class name | ||
return this.constructor.name; | ||
} | ||
constructor(data) { | ||
@@ -106,3 +112,2 @@ if (data) { | ||
this.Type = QueueMessageType.Job; | ||
this.Name = this.constructor.name; | ||
} | ||
@@ -145,6 +150,7 @@ static async emit(val, options) { | ||
const options = Reflect.getMetadata('queue:options', event); | ||
const eName = event.Name ?? event.name; | ||
const eName = event.Name ?? event.name ?? event.constructor.name; | ||
const isJob = event.Type ? event.Type === QueueMessageType.Job : options ? options.type === 'job' : false; | ||
const rOption = this.Routing[eName]; | ||
if (!rOption) { | ||
this.Log.warn(`No routing for event ${eName} found, using default channel`); | ||
return [isJob ? this.Options.defaultQueueChannel : this.Options.defaultTopicChannel]; | ||
@@ -151,0 +157,0 @@ } |
@@ -50,3 +50,3 @@ import { AsyncService, Constructor, IInstanceCheck, IMappableService } from '@spinajs/di'; | ||
CreatedAt: DateTime; | ||
Name: string; | ||
get Name(): string; | ||
Type: QueueMessageType; | ||
@@ -53,0 +53,0 @@ Persistent: boolean; |
@@ -49,2 +49,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
export class QueueMessage { | ||
// event name | ||
// defaults to class name | ||
get Name() { | ||
// default name is class name | ||
return this.constructor.name; | ||
} | ||
constructor(data) { | ||
@@ -96,3 +102,2 @@ if (data) { | ||
this.Type = QueueMessageType.Job; | ||
this.Name = this.constructor.name; | ||
} | ||
@@ -134,6 +139,7 @@ static async emit(val, options) { | ||
const options = Reflect.getMetadata('queue:options', event); | ||
const eName = event.Name ?? event.name; | ||
const eName = event.Name ?? event.name ?? event.constructor.name; | ||
const isJob = event.Type ? event.Type === QueueMessageType.Job : options ? options.type === 'job' : false; | ||
const rOption = this.Routing[eName]; | ||
if (!rOption) { | ||
this.Log.warn(`No routing for event ${eName} found, using default channel`); | ||
return [isJob ? this.Options.defaultQueueChannel : this.Options.defaultTopicChannel]; | ||
@@ -140,0 +146,0 @@ } |
{ | ||
"name": "@spinajs/queue", | ||
"version": "2.0.199", | ||
"version": "2.0.200", | ||
"description": "queue sending & pulling made easy", | ||
@@ -57,7 +57,7 @@ | ||
"dependencies": { | ||
"@spinajs/configuration": "^2.0.199", | ||
"@spinajs/di": "^2.0.199", | ||
"@spinajs/exceptions": "^2.0.199", | ||
"@spinajs/log": "^2.0.199", | ||
"@spinajs/orm": "^2.0.199", | ||
"@spinajs/configuration": "^2.0.200", | ||
"@spinajs/di": "^2.0.200", | ||
"@spinajs/exceptions": "^2.0.200", | ||
"@spinajs/log": "^2.0.200", | ||
"@spinajs/orm": "^2.0.200", | ||
"luxon": "^3.2.1" | ||
@@ -64,0 +64,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259284
1635
Updated@spinajs/di@^2.0.200
Updated@spinajs/exceptions@^2.0.200
Updated@spinajs/log@^2.0.200
Updated@spinajs/orm@^2.0.200