GeezerVison is showing github.com — Revert "Removed IEventQueue" · rchcomm/Exceptionless.JavaScript@d27fb79
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/core/src/configuration/Configuration.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,6 +9,7 @@ import { ReferenceIdPlugin } from "../plugins/default/ReferenceIdPlugin.js"; |
9 | 9 | import { EventPluginContext } from "../plugins/EventPluginContext.js"; |
10 | 10 | import { IEventPlugin } from "../plugins/IEventPlugin.js"; |
11 | 11 | import { DefaultEventQueue } from "../queue/DefaultEventQueue.js"; |
| 12 | +import { IEventQueue } from "../queue/IEventQueue.js"; |
12 | 13 | import { ISubmissionClient } from "../submission/ISubmissionClient.js"; |
13 | 14 | import { DefaultSubmissionClient } from "../submission/DefaultSubmissionClient.js"; |
14 | 15 | import { guid } from "../Utils.js"; |
@@ -545,5 +546,5 @@ interface IConfigurationServices { |
545 | 546 | log: ILog; |
546 | 547 | submissionClient: ISubmissionClient; |
547 | 548 | storage: IStorage; |
548 | | - queue: DefaultEventQueue; |
| 549 | + queue: IEventQueue; |
549 | 550 | } |
Collapse file
Copy file name to clipboardExpand all lines: packages/core/src/index.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,6 +39,7 @@ export { EventPluginManager } from "./plugins/EventPluginManager.js"; |
39 | 39 | export type { IEventPlugin } from "./plugins/IEventPlugin.js"; |
40 | 40 |
|
41 | 41 | export { DefaultEventQueue } from "./queue/DefaultEventQueue.js"; |
| 42 | +export type { IEventQueue } from "./queue/IEventQueue.js"; |
42 | 43 |
|
43 | 44 | export { InMemoryStorage } from "./storage/InMemoryStorage.js"; |
44 | 45 | export { LocalStorage } from "./storage/LocalStorage.js"; |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/core/src/queue/DefaultEventQueue.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { Configuration } from "../configuration/Configuration.js"; |
2 | 2 | import { ILog } from "../logging/ILog.js"; |
3 | 3 | import { Event } from "../models/Event.js"; |
| 4 | +import { IEventQueue } from "../queue/IEventQueue.js"; |
4 | 5 | import { Response } from "../submission/Response.js"; |
5 | 6 |
|
6 | 7 | interface EventQueueItem { |
7 | 8 | file: string, |
8 | 9 | event: Event |
9 | 10 | } |
10 | 11 |
|
11 | | -export class DefaultEventQueue { |
| 12 | +export class DefaultEventQueue implements IEventQueue { |
12 | 13 | /** |
13 | 14 | * A list of handlers that will be fired when events are submitted. |
14 | 15 | * @type {Array} |
|
Collapse file
Copy file name to clipboard +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { Event } from "../models/Event.js"; |
| 2 | +import { Response } from "../submission/Response.js"; |
| 3 | + |
| 4 | +export interface IEventQueue { |
| 5 | + /** Enqueue an event */ |
| 6 | + enqueue(event: Event): Promise<void>; |
| 7 | + /** Processes all events in the queue */ |
| 8 | + process(): Promise<void>; |
| 9 | + /** Starts queue timers */ |
| 10 | + startup(): Promise<void>; |
| 11 | + /** Suspends queue timers */ |
| 12 | + suspend(): Promise<void>; |
| 13 | + /** Suspends processing of events for a specific duration */ |
| 14 | + suspendProcessing(durationInMinutes?: number, discardFutureQueuedItems?: boolean, clearQueue?: boolean): Promise<void>; |
| 15 | + // TODO: See if this makes sense. |
| 16 | + onEventsPosted(handler: (events: Event[], response: Response) => Promise<void>): void; |
| 17 | +} |