Skip to content

Commit

Permalink
Merge pull request #1055 from scramjetorg/fix/topic-remove
Browse files Browse the repository at this point in the history
cli topic create connection
  • Loading branch information
patuwwy authored Mar 14, 2024
2 parents c6c24ea + d4053b9 commit 789eda4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/host/src/lib/serviceDiscovery/sd-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class ServiceDiscovery {
* Returns topic with given configuration, if not exists creates new one.
*
* @param {DataType} config Topic configuration.
* @param {string} [localProvider] Provider identifier. It not set topic will be considered as external.
* @returns added topic data.
*/
createTopicIfNotExist(config: DataType) {
Expand All @@ -94,6 +93,7 @@ export class ServiceDiscovery {
throw new Error("Content-type mismatch");
}
this.logger.debug("Topic routed:", config);

return topic;
}

Expand Down
6 changes: 6 additions & 0 deletions packages/host/src/lib/serviceDiscovery/topicRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ class TopicRouter {

const topic = this.serviceDiscovery.createTopicIfNotExist({ topic: topicId, contentType });

await this.serviceDiscovery.update({
contentType,
topicName: topicId.toString(),
status: "add"
});

return {
opStatus: ReasonPhrases.OK,
id: topic.id(),
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/messages/sth-topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type AddSTHTopicEventData = BaseSTHTopicEventData & {
} & (
{ requires: string; provides?: never }
| { provides: string; requires?: never }
| { requires?: never; provides?: never }
);

export type RemoveSTHTopicEventData = BaseSTHTopicEventData & {
Expand Down

0 comments on commit 789eda4

Please sign in to comment.