英文:
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);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论