Skip to content

Commit 2e2461c

Browse files
committed
Libs: remove beta "events public" and replace with "message poller"
There are new symbol names for the polling endpoint APIs, now no longer gated by the `svix_beta` cargo feature in the Rust SDK. These are now available in all Libs. Relevant updates were made to svix-cli and svix-bridge to account for the SDK changes, and to ensure user-facing terms are consistent.
1 parent e185ece commit 2e2461c

38 files changed

+242
-1086
lines changed

bridge/svix-bridge.example.receivers.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ opentelemetry:
2525
# Inputs types are "webhook" which allows you to configure a verification scheme
2626
# (either "svix" or "none") or "svix-webhook" which is a shorthand version.
2727
#
28+
# There is also a "svix-message-poller" input type which will poll a polling endpoint
29+
# rather than waiting for incoming messages.
30+
#
2831
# ```
2932
# input:
3033
# type: "webhook"
@@ -125,3 +128,17 @@ receivers:
125128
# Only for SASL
126129
kafka_sasl_username: "user"
127130
kafka_sasl_password: "pass"
131+
132+
- name: "msg-poller-to-rabbitmq-example"
133+
input:
134+
type: "svix-message-poller"
135+
consumer_id: "example-consumer"
136+
# The app and sink ids can be seen in the URL for the corresponding Polling Endpoint.
137+
app_id: "my-app-uid"
138+
sink_id: "poll_XXXX"
139+
token: "${POLLING_ENDPOINT_TOKEN}"
140+
output:
141+
type: "rabbitmq"
142+
uri: "${QUEUE_URI}"
143+
exchange: ""
144+
routing_key: "my_queue"

bridge/svix-bridge/src/config/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl WebhookReceiverConfig {
242242
#[derive(Clone, Deserialize)]
243243
#[serde(tag = "type", rename_all = "kebab-case")]
244244
pub enum PollerInputOpts {
245-
SvixPollingEndpoint {
245+
SvixMessagePoller {
246246
/// Identifies this client, allowing the server to track progress during iteration.
247247
/// Processes should not share a consumer id. Only exclusive access is permitted.
248248
consumer_id: String,
@@ -260,7 +260,7 @@ pub enum PollerInputOpts {
260260
impl PollerInputOpts {
261261
pub fn svix_client(&self) -> Option<Svix> {
262262
match self {
263-
PollerInputOpts::SvixPollingEndpoint {
263+
PollerInputOpts::SvixMessagePoller {
264264
token,
265265
svix_options,
266266
..

bridge/svix-bridge/src/config/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ fn test_pollers_parse_ok() {
618618
receivers:
619619
- name: "poller-to-rabbitmq-example"
620620
input:
621-
type: "svix-polling-endpoint"
621+
type: "svix-message-poller"
622622
consumer_id: "my-consumer"
623623
app_id: "app_AbCd"
624624
sink_id: "poll_aBcD"

bridge/svix-bridge/src/webhook_receiver/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use axum::{
99
use svix_bridge_types::{
1010
async_trait,
1111
svix::{
12-
api::{EventsPublicConsumerOptions, Svix},
12+
api::{MessagePollerConsumerPollOptions, Svix},
1313
error::Error,
1414
},
1515
ForwardRequest, PollerInput, ReceiverOutput, TransformationConfig, TransformerInput,
@@ -258,7 +258,7 @@ async fn run_inner(poller: &SvixEventsPoller) -> ! {
258258
const NO_SLEEP: Duration = Duration::ZERO;
259259
let mut sleep_time = NO_SLEEP;
260260

261-
let PollerInputOpts::SvixPollingEndpoint {
261+
let PollerInputOpts::SvixMessagePoller {
262262
consumer_id,
263263
token: _,
264264
app_id,
@@ -269,19 +269,18 @@ async fn run_inner(poller: &SvixEventsPoller) -> ! {
269269
let mut iterator = None;
270270

271271
'outer: loop {
272-
tracing::trace!(app_id, sink_id, "polling endpoint");
272+
tracing::trace!(app_id, sink_id, "polling poller");
273273
match poller
274274
.svix_client
275-
.events_public()
276-
.consumer(
275+
.message()
276+
.poller()
277+
.consumer_poll(
277278
app_id.clone(),
278279
sink_id.clone(),
279280
consumer_id.clone(),
280-
Some(EventsPublicConsumerOptions {
281+
Some(MessagePollerConsumerPollOptions {
281282
limit: None,
282283
iterator: iterator.clone(),
283-
event_type: None,
284-
channel: None,
285284
}),
286285
)
287286
.await

csharp/Svix/EventsPublic.cs

Lines changed: 0 additions & 198 deletions
This file was deleted.

csharp/Svix/MessagePoller.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,11 @@ public class MessagePollerConsumerPollOptions : SvixOptionsBase
3232
{
3333
public ulong? Limit { get; set; }
3434
public string? Iterator { get; set; }
35-
public string? EventType { get; set; }
36-
public string? Channel { get; set; }
3735

3836
public new Dictionary<string, string> QueryParams()
3937
{
4038
return SerializeParams(
41-
new Dictionary<string, object?>
42-
{
43-
{ "limit", Limit },
44-
{ "iterator", Iterator },
45-
{ "event_type", EventType },
46-
{ "channel", Channel },
47-
}
39+
new Dictionary<string, object?> { { "limit", Limit }, { "iterator", Iterator } }
4840
);
4941
}
5042
}

go/message_poller.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ type MessagePollerConsumerPollOptions struct {
3636
Limit *uint64
3737
// The iterator returned from a prior invocation
3838
Iterator *string
39-
// Filters messages sent with this event type (optional).
40-
EventType *string
41-
// Filters messages sent with this channel (optional).
42-
Channel *string
4339
}
4440

4541
type MessagePollerConsumerSeekOptions struct {
@@ -100,8 +96,6 @@ func (messagePoller *MessagePoller) ConsumerPoll(
10096
if o != nil {
10197
internal.SerializeParamToMap("limit", o.Limit, queryMap, &err)
10298
internal.SerializeParamToMap("iterator", o.Iterator, queryMap, &err)
103-
internal.SerializeParamToMap("event_type", o.EventType, queryMap, &err)
104-
internal.SerializeParamToMap("channel", o.Channel, queryMap, &err)
10599
if err != nil {
106100
return nil, err
107101
}

go/models/api_token_out.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "time"
66
type ApiTokenOut struct {
77
CreatedAt time.Time `json:"createdAt"`
88
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
9-
Id string `json:"id"` // The ApplicationToken's ID.
9+
Id string `json:"id"` // The GlobalApplicationToken's ID.
1010
Name *string `json:"name,omitempty"`
1111
Scopes []string `json:"scopes,omitempty"`
1212
Token string `json:"token"`

0 commit comments

Comments
 (0)