PostgreSQL(Greenplum)是否可以在数据库内部数据更新时发布消息?

huangapple go评论56阅读模式
英文:

Is it possible for postgresdb (greenplum) to publish messages whenever the data inside to DB is updated?

问题

我正在尝试将缓存(Gemfire)与Greenplum数据库保持同步。数据库接收来自外部来源的数据更新。

我考虑使用数据库在数据库更新数据时发送触发器,但我想知道是否有一种方法让数据库向外部来源发布消息。

Greenplum中有一个通知函数,所以是否可能让Kafka或Gemfire监听Greenplum通知消息的相同通道?

英文:

I'm trying to sync the cache (gemfire) to be the same as the greenplum database. The database receives data updates from external sources.

I thought of using the database to send a trigger whenever the data in the database is updated, but I was wondering if there is a way for the database to publish messages to external sources.

There is a notify function in greenplum, so is it possible for Kafka or Gemfire to listen to the same channel that greenplum is notifying messages to?

答案1

得分: 1

你可以使用像pg_amqp这样的扩展与Greenplum一起,将消息中继到像RabbitMQ这样的故障系统。在设置好这个扩展之后,可以使用Greenplum规则系统(https://docs.vmware.com/en/VMware-Greenplum/6/greenplum-database/ref_guide-sql_commands-CREATE_RULE.html)来决定何时发送消息。

示例:
创建规则customers_ins,当向customers插入数据时,执行以下操作:选择amqp.publish(1, '', 'customersQ', 'Newval:' || new.id)。

英文:

You can use an extension like pg_amqp with greenplum to relay messages to a broken like rabbitmq for example. After you set up this extension, the greenplum rule system (https://docs.vmware.com/en/VMware-Greenplum/6/greenplum-database/ref_guide-sql_commands-CREATE_RULE.html) can be used to decide when to sent messages.

Example:
create rule customers_ins as on insert to customers do select amqp.publish(1,'','customersQ','Newval:'||new.id);

huangapple
  • 本文由 发表于 2023年6月22日 09:23:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76528096.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定