Effect CommunityEC
Effect Community11mo ago
3 replies
Madyan

Can the PubSub feature be used with cloud services?

I'm using Effect's PubSub to publish messages and subscribe to them for every client connected to a certain chat API endpoint.

The plan was to "hook it up" with a cloud provider to make it production-ready, but I'm realising now that doesn't seem to be supported?

So am I right in thinking that Effect's PubSub isn't meant to be used that way, and instead I should be making my own Effectful wrapper around whatever cloud PubSub SDK I'm using?

In my case I'm trying to integrate it with Encore's PubSub feature, which looks like:

import { Topic } from "encore.dev/pubsub"

export interface SignupEvent {
    userID: string;
}

export const signups = new Topic<SignupEvent>("signups", {
    deliveryGuarantee: "at-least-once",
});


import { Subscription } from "encore.dev/pubsub";

const _ = new Subscription(signups, "send-welcome-email", {
    handler: async (event) => {
        // Send a welcome email using the event.
    },
});
Was this page helpful?