PostgreSQL和JMS(或其他Pub

编程入门 行业动态 更新时间:2024-10-27 07:21:59
本文介绍了PostgreSQL和JMS(或其他Pub-Sub /回调机制)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想让我的PostgreSQL服务器在一段数据更改时发送通知,最好是通过JMS,还要考虑任何其他Pub-Sub机制或回调。

I want to have my PostgreSQL server send out notifications when a piece of data changes, preferably over JMS, but also considering any other Pub-Sub mechanism or Callback.

如果可能的话,有什么想法吗?

Any ideas if this is possible?

是否有任何可用的Java附加软件包可以复制这种功能?

Are there any available Java Add-on Packages that replicate this sort of functionality?

推荐答案

编辑:我被告知PostgreSQL 支持Java中的存储过程。这意味着以下方法变得可行:

I've been informed that PostgreSQL does support stored procedures in Java. That means the following approach becomes feasible:

基本上,我想要的方法是将触发器放在你想要观看的任何内容上,然后调用存储过程从那以后。然后,存储过程需要与DB服务器外部的世界通信;我曾经在Java中使用这样的SP来打开与同一服务器上的进程的套接字连接,并监听端口。如果最糟糕的情况发生了,你可以编写一个文件并使用imon监视该文件,或者你可以在自己的exec()shell中启动一个程序......就像那样。

Essentially, the way I would go is to put a trigger on whatever it is you want to watch, and then call a stored procedure from that. The stored procedure then needs to communicate with the world outside the DB server; I once did an SP like this in Java that opened up a socket connection to a process on the same server listening on a port. If worst came to worst, you could maybe write a file and have something like imon monitoring that file, or you could start up a program in an exec() shell of its own... something like that.

更多推荐

PostgreSQL和JMS(或其他Pub

本文发布于:2023-10-29 03:01:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538538.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:或其他   PostgreSQL   JMS   Pub

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!