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 1717- [Prepared statements](#prepared-statements)
1818- [Transactions](#transactions)
1919- [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)
2021- [Contributing](#contributing)
2122- [Licence](#licence)
2223
@@ -269,6 +270,21 @@ disconnect and the connection is closed.
269270You can also use the ` ConnectionPool ` provided by the driver to simplify working with database connections in your app.
270271Check the blog post above for more details and the project's ScalaDocs.
271272
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+
272288## Contributing
273289
274290Contributing 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