File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 17
17
- [Prepared statements](#prepared-statements)
18
18
- [Transactions](#transactions)
19
19
- [Example usage (for PostgreSQL, but it looks almost the same on MySQL)](#example-usage-for-postgresql-but-it-looks-almost-the-same-on-mysql)
20
+ - [LISTEN/NOTIFY support (PostgreSQL only)](#listennotify-support-postgresql-only)
20
21
- [Contributing](#contributing)
21
22
- [Licence](#licence)
22
23
@@ -269,6 +270,21 @@ disconnect and the connection is closed.
269
270
You can also use the ` ConnectionPool ` provided by the driver to simplify working with database connections in your app.
270
271
Check the blog post above for more details and the project's ScalaDocs.
271
272
273
+ ## LISTEN/NOTIFY support (PostgreSQL only)
274
+
275
+ LISTEN/NOTIFY is a PostgreSQL-specific feature for database-wide publish-subscribe scenarios. You can listen to database
276
+ notifications as such:
277
+
278
+ ``` scala
279
+ val connection : Connection = ...
280
+
281
+ connection.sendQuery(" LISTEN my_channel" )
282
+ connection.registerNotifyListener {
283
+ message =>
284
+ println(s " channel: ${message.channel}, payload: ${message.payload}" )
285
+ }
286
+ ```
287
+
272
288
## Contributing
273
289
274
290
Contributing to the project is simple, fork it on Github, hack on what you're insterested in seeing done or at the
You can’t perform that action at this time.
0 commit comments