feat(medusa,event-bus-local,event-bus-redis): Event Bus modules (#2599)

This commit is contained in:
Oliver Windall Juhl
2023-03-22 10:26:21 +01:00
committed by GitHub
parent 7408111d11
commit ef5ef9f5a2
114 changed files with 2423 additions and 1669 deletions
+14 -6
View File
@@ -1,7 +1,9 @@
import BatchJobService from "../services/batch-job"
import EventBusService from "../services/event-bus"
import { StrategyResolverService } from "../services"
import { EntityManager } from "typeorm"
import {
BatchJobService,
EventBusService,
StrategyResolverService,
} from "../services"
type InjectedDependencies = {
eventBusService: EventBusService
@@ -27,9 +29,15 @@ class BatchJobSubscriber {
this.strategyResolver_ = strategyResolverService
this.manager_ = manager
this.eventBusService_
.subscribe(BatchJobService.Events.CREATED, this.preProcessBatchJob)
.subscribe(BatchJobService.Events.CONFIRMED, this.processBatchJob)
this.eventBusService_.subscribe(
BatchJobService.Events.CREATED,
this.preProcessBatchJob
) as EventBusService
this.eventBusService_.subscribe(
BatchJobService.Events.CONFIRMED,
this.processBatchJob
) as EventBusService
}
preProcessBatchJob = async (data): Promise<void> => {
+1 -2
View File
@@ -1,6 +1,5 @@
import EventBusService from "../services/event-bus"
import { CartService } from "../services"
import { EntityManager } from "typeorm"
import { CartService, EventBusService } from "../services"
type InjectedDependencies = {
eventBusService: EventBusService
@@ -1,21 +1,21 @@
import { EventBusTypes } from "@medusajs/types"
import { indexTypes } from "medusa-core-utils"
import { ISearchService } from "../interfaces"
import ProductCategoryFeatureFlag from "../loaders/feature-flags/product-categories"
import { SEARCH_INDEX_EVENT } from "../loaders/search-index"
import { Product } from "../models"
import EventBusService from "../services/event-bus"
import ProductService from "../services/product"
import { FlagRouter } from "../utils/flag-router"
type InjectedDependencies = {
eventBusService: EventBusService
eventBusService: EventBusTypes.IEventBusService
searchService: ISearchService
productService: ProductService
featureFlagRouter: FlagRouter
}
class SearchIndexingSubscriber {
private readonly eventBusService_: EventBusService
private readonly eventBusService_: EventBusTypes.IEventBusService
private readonly searchService_: ISearchService
private readonly productService_: ProductService
private readonly featureFlagRouter_: FlagRouter