跳转到主要内容

omni_cloudevents

Omnigres CloudEvents 支持

omnigres · Omnigres CloudEvents 支持

概览

ID扩展软件包版本类别许可证编程语言
2943omni_cloudeventsomnigres0.1.0FEATApache-2.0C
属性可执行文件动态库需要预加载需要建扩展可迁移可信
----dt-否否否是否是

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY0.1.019 18 17 16 15omnigresomni_web
RPMPIGSTY2026021219 18 17 16 15omnigres_$vpostgresql$v-contrib, postgresql$v-plpython3, python3-pip
DEBPIGSTY2026021219 18 17 16 15postgresql-$v-omnigrespostgresql-plpython3-$v, python3-pip
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el8.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el9.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el9.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el10.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el10.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d12.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d12.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d13.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d13.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u22.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u22.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u24.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u24.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u26.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u26.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212

源码

docs.omnigres.org/omni_cloudevents/cloud_events/

pig build pkg omnigres;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install omnigres;		# install by package name
pig install omni_cloudevents;		# install by extension name

pig install omni_cloudevents -v 18;   # install for PG 18
pig install omni_cloudevents -v 17;   # install for PG 17
pig install omni_cloudevents -v 16;   # install for PG 16
pig install omni_cloudevents -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION omni_cloudevents CASCADE; -- requires omni_web

用法

omni_cloudevents: CloudEvents 支持

omni_cloudevents 扩展支持在 SQL 中创建、验证和发布标准化的 CloudEvents。它是一个模板化扩展。

初始化

SELECT omni_cloudevents.instantiate(schema => 'omni_cloudevents');
SET search_path TO omni_cloudevents, public;

创建事件

SELECT cloudevent(
    id     => gen_random_uuid(),
    source => 'https://service.com/endpoint',
    type   => 'user.login'
);

可选参数:datacontenttype、dataschema、subject、ts(默认为当前时间)、data(任意 PG 类型)、specversion(默认 1.0)。

发布事件

SELECT publish(
    cloudevent(
        id     => gen_random_uuid(),
        source => 'https://api.yourservice.com/sys',
        type   => 'file.uploaded',
        data   => 'data-lake-bucket-123'::text
    )
);

已发布的事件持久化在 cloudevents_egress 表中。

NOTICE 发布器

SELECT omni_cloudevents.create_notice_publisher();
-- 观察未提交的事件:
SELECT omni_cloudevents.create_notice_publisher(publish_uncommitted => true);
-- 删除发布器:
SELECT omni_cloudevents.delete_publisher(name);

事件生成包含完整事件详情的 JSON 格式 NOTICE 消息。

表格阅读器