UNPKG

1.68 kBMarkdownView Raw
1# notification-processor
2
3[![NPM version](https://badge.fury.io/js/notification-processor.png)](http://badge.fury.io/js/notification-processor)
4
5# Breaking change
6* Configure API URL and Notification API URL at job processor
7```Javascript
8//2.x
9require("notification-processor").JobProcessor({
10 buildOpts: (message) => ({}), notificationApiUrl: "apiNotificationUrl"
11})
12
13//3.x
14require("notification-processor").JobProcessor({
15 apiUrl: "",
16 notificationApiUrl: ""
17})
18```
19
20# New Features
21* Adding request async processor
22
23```Javascript
24require("notification-processor").RequestAsyncProcessor({
25 apiUrl: "baseAPI..."
26 silentErrors: []
27})
28```
29
30# Migrating 1.x -> 2.x
31
32## Deadletter Processor
33```Javascript
34// 1.x
35const buildOpts = (message) => { return .... }
36deadletterProcessor = DeadletterProcessor({
37 connection: connection,
38 name: "aFunctionName",
39 maxDequeueCount: 1,
40 rowKeyGenerator: (message) => { return ...... }
41}, processor())
42
43// 2.x
44const buildOpts = (message) => { return .... }
45const sender = {
46 resource: (notification) => { return ... }
47 user: (notification) => { return ... }
48}
49
50deadletterProcessor = DeadletterProcessor({
51 connection: connection,
52 name: "aFunctionName",
53 maxDequeueCount: 1,
54 sender: sender
55}, processor())
56
57```
58
59## Job Processor
60```JavaScript
61
62// 1.x
63const buildOpts = (message) => { return .... }
64const processor = JobsProcessor(buildOpts, nonRetryable)
65
66// 2.x
67const buildOpts = ({ message }) => { return ...... }
68const processor = JobsProcessor({
69 buildOpts: optionsGenerator,
70 maxRetries,
71 nonRetryable
72})
73```
74