import ParameterTypes from "@site/src/components/ParameterTypes"

# IEventBusService

## Methods

### emit

#### Type Parameters

<ParameterTypes parameters={[
  {
    "name": "T",
    "type": "`object`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "event",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "data",
    "type": "`T`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "options",
    "type": "`unknown`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;unknown&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": [
      {
        "name": "unknown",
        "type": "`unknown`",
        "optional": true,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

___

### subscribe

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "eventName",
    "type": "`string` \\| `symbol`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "subscriber",
    "type": "[Subscriber](../types/types.EventBusTypes.Subscriber.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "context",
    "type": "[SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "subscriberId",
        "type": "`string`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "emit",
    "type": "`<T>`(`event`: `string`, `data`: `T`, `options?`: `unknown`) => Promise&#60;unknown&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "subscribe",
    "type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "unsubscribe",
    "type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "withTransaction",
    "type": "(`transactionManager?`: `EntityManager`) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

___

### unsubscribe

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "eventName",
    "type": "`string` \\| `symbol`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "subscriber",
    "type": "[Subscriber](../types/types.EventBusTypes.Subscriber.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "context",
    "type": "[SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "subscriberId",
        "type": "`string`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "emit",
    "type": "`<T>`(`event`: `string`, `data`: `T`, `options?`: `unknown`) => Promise&#60;unknown&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "subscribe",
    "type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "unsubscribe",
    "type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "withTransaction",
    "type": "(`transactionManager?`: `EntityManager`) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

___

### withTransaction

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "transactionManager",
    "type": "`EntityManager`",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

#### Returns

<ParameterTypes parameters={[
  {
    "name": "emit",
    "type": "`<T>`(`event`: `string`, `data`: `T`, `options?`: `unknown`) => Promise&#60;unknown&#62;",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "subscribe",
    "type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "unsubscribe",
    "type": "(`eventName`: `string` \\| `symbol`, `subscriber`: [Subscriber](../types/types.EventBusTypes.Subscriber.mdx), `context?`: [SubscriberContext](../types/types.EventBusTypes.SubscriberContext.mdx)) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "withTransaction",
    "type": "(`transactionManager?`: `EntityManager`) => [IEventBusService](types.EventBusTypes.IEventBusService.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />
