feat: include dakao send result subjects
This commit is contained in:
1 parent
245a096606
commit
e63fba0286
3 files changed
+22
-1
No files matched your search
@@ -97,6 +97,10 @@ describe('DakaoPublisher', () => {
|
|||||||
eventSource: 'lolympus',
|
eventSource: 'lolympus',
|
||||||
type: 'chat.send-message',
|
type: 'chat.send-message',
|
||||||
correlationId: 'chat-log-1',
|
correlationId: 'chat-log-1',
|
||||||
|
resultSubjects: {
|
||||||
|
succeeded: 'staging.lolympus.dakao.chat.send-message.succeeded.v1',
|
||||||
|
failed: 'staging.lolympus.dakao.chat.send-message.failed.v1',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
expect(getPublishedEnvelope(outboxService)).not.toHaveProperty(
|
expect(getPublishedEnvelope(outboxService)).not.toHaveProperty(
|
||||||
'replySubject',
|
'replySubject',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { randomUUID } from 'crypto';
|
|||||||
import { SecretService } from '../global/secret/secret.service';
|
import { SecretService } from '../global/secret/secret.service';
|
||||||
import {
|
import {
|
||||||
DakaoCommandEnvelope,
|
DakaoCommandEnvelope,
|
||||||
|
DakaoResultSubjects,
|
||||||
DakaoSegment,
|
DakaoSegment,
|
||||||
DakaoSendMessagePayload,
|
DakaoSendMessagePayload,
|
||||||
} from './dakao.types';
|
} from './dakao.types';
|
||||||
@@ -16,7 +17,12 @@ const EVENT_SOURCE_DEFAULT = 'lolympus';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class DakaoPublisher implements OnModuleInit {
|
export class DakaoPublisher implements OnModuleInit {
|
||||||
private readonly logger = new Logger(DakaoPublisher.name);
|
private readonly logger = new Logger(DakaoPublisher.name);
|
||||||
private sendMessageSubject = resolveDakaoNatsNames().subjects.chatSendMessage;
|
private readonly names = resolveDakaoNatsNames();
|
||||||
|
private sendMessageSubject = this.names.subjects.chatSendMessage;
|
||||||
|
private resultSubjects: DakaoResultSubjects = {
|
||||||
|
succeeded: this.names.subjects.chatSendMessageSucceeded,
|
||||||
|
failed: this.names.subjects.chatSendMessageFailed,
|
||||||
|
};
|
||||||
private eventSource = EVENT_SOURCE_DEFAULT;
|
private eventSource = EVENT_SOURCE_DEFAULT;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -35,6 +41,10 @@ export class DakaoPublisher implements OnModuleInit {
|
|||||||
|
|
||||||
this.sendMessageSubject =
|
this.sendMessageSubject =
|
||||||
sendOverride || resolveDakaoNatsNames().subjects.chatSendMessage;
|
sendOverride || resolveDakaoNatsNames().subjects.chatSendMessage;
|
||||||
|
this.resultSubjects = {
|
||||||
|
succeeded: this.names.subjects.chatSendMessageSucceeded,
|
||||||
|
failed: this.names.subjects.chatSendMessageFailed,
|
||||||
|
};
|
||||||
this.eventSource = sourceOverride || EVENT_SOURCE_DEFAULT;
|
this.eventSource = sourceOverride || EVENT_SOURCE_DEFAULT;
|
||||||
|
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
@@ -63,6 +73,7 @@ export class DakaoPublisher implements OnModuleInit {
|
|||||||
type: 'chat.send-message',
|
type: 'chat.send-message',
|
||||||
eventSource: this.eventSource,
|
eventSource: this.eventSource,
|
||||||
correlationId: params.correlationId,
|
correlationId: params.correlationId,
|
||||||
|
resultSubjects: this.resultSubjects,
|
||||||
payload,
|
payload,
|
||||||
};
|
};
|
||||||
await this.outboxService.enqueueAndPublish({
|
await this.outboxService.enqueueAndPublish({
|
||||||
|
|||||||
@@ -75,12 +75,18 @@ export interface DakaoSendMessagePayload {
|
|||||||
silence?: boolean;
|
silence?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DakaoResultSubjects {
|
||||||
|
succeeded: string;
|
||||||
|
failed: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DakaoCommandEnvelope<TPayload> {
|
export interface DakaoCommandEnvelope<TPayload> {
|
||||||
schema: 'dakao.command.v1';
|
schema: 'dakao.command.v1';
|
||||||
eventId: string;
|
eventId: string;
|
||||||
type: string;
|
type: string;
|
||||||
eventSource: string;
|
eventSource: string;
|
||||||
correlationId?: string;
|
correlationId?: string;
|
||||||
|
resultSubjects?: DakaoResultSubjects;
|
||||||
payload: TPayload;
|
payload: TPayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user