Skip to content

Commit

Permalink
chore: minor pubsub docs update (#3820)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored Dec 19, 2024
1 parent b9e1d70 commit cd76a2e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docs/content/docs/reference/pubsub.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ First, declare a new topic:
```go
package payments

import (
"github.com/block/ftl/go-runtime/ftl"
)
type Invoice struct {
InvoiceNo string
}

//ftl:export
type Invoices = ftl.TopicHandle[Invoice, ftl.SinglePartitionMap[Invoice]]
```

Expand Down Expand Up @@ -53,6 +61,11 @@ func PublishInvoice(ctx context.Context, topic Invoices) error {
First, declare a new topic :

```kotlin

import com.block.ftl.WriteableTopic

data class Invoice(val invoiceNo: String)

@Export
@Topic("invoices")
internal interface InvoiceTopic : WriteableTopic<Invoice>
Expand Down Expand Up @@ -89,9 +102,13 @@ internal interface InvoiceTopic : ConsumableTopic<Invoice>
First, declare a new topic:

```java
import com.block.ftl.WriteableTopic;

record Invoice(String invoiceNo) {}

@Export
@Topic("invoices")
interface InvoiceTopic extends WriteableTopic<Invoice> {}
public interface InvoiceTopic extends WriteableTopic<Invoice> {}
```

Events can be published to a topic by injecting it into an `@Verb` method:
Expand Down

0 comments on commit cd76a2e

Please sign in to comment.