pedestal

Joe Lane 2020-05-26T14:03:22.144900Z

You can "leverage the interceptor model" by creating your own interceptor chain and run all onmessage events through said chain. Pedestal interceptors are NOT coupled to HTTP, I've used them with queues, my own domain logic, I've even seen them with kafka.

Joe Lane 2020-05-26T14:09:06.145200Z

https://github.com/cognitect-labs/pedestal.kafka

mpenet 2020-05-26T14:11:29.146300Z

lots of libs use that pattern now, it's basically an enhanced middleware pattern (open/modifiable stack/queue). There are also a few libs that make it usable with manifold, completablefutures, cljs etc (basically implementing their own chain runner, with some slight modifications sometimes, since it's not specified)

Joe Lane 2020-05-26T14:19:21.147500Z

The difference between middleware and interceptors being functions vs data, respectively.

mpenet 2020-05-26T14:19:37.147800Z

closure vs explicit context

mpenet 2020-05-26T14:19:43.148Z

but yes, kinda

Joe Lane 2020-05-26T14:19:57.148500Z

I like your description more.

mpenet 2020-05-26T14:19:59.148600Z

also interceptors you can modify on the fly the chain

mpenet 2020-05-26T14:21:18.149800Z

then some impl re-wrap errors, some dont etc etc, small variations

hindol 2020-05-26T17:25:27.151700Z

@lanejo01 Thank you for the link. I really love the interceptor model. I find it much easier to wrap my head around than the middleware pattern. I have been looking at Sieppari for a general purpose interceptor chain but if Pedestal interceptors can be adapted, I will go with that instead.

👍 1
🚀 1
hlship 2020-05-26T20:13:19.152100Z

We use them as wrappers around outgoing HTTP requests as well, to add logging/retries/QoS/encoding & decoding ...

2020-05-26T21:14:24.153100Z

FYI, I’ve created https://github.com/pedestal/pedestal/issues/659 to track the creation of a session-aware WebSocketListener impl

⭐ 4