Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSubscriptionTopicNotResource = errRange.New( "Invalid call to pubsub.NewSubscription", "pubsub.NewSubscription requires the first argument to be a resource of type pubsub.Topic.", errors.PrependDetails(pubsubNewSubscriptionHelp), ) ErrTopicNameNotUnique = errRange.New( "Duplicate PubSub topic name", "A PubSub topic name must be unique within a service.", errors.PrependDetails("If you wish to reuse the same topic, then you can export the original Topic object import it here."), ) ErrSubscriptionNameNotUnique = errRange.New( "Duplicate PubSub subscription on topic", "Subscription names on topics must be unique.", ) ErrUnableToIdentifyServicesInvolved = errRange.New( "Unable to identify services involved", "Unable to identify services involved in the PubSub subscription.", errors.MarkAsInternalError(), ) ErrSubscriptionHandlerNotDefinedInSameService = errRange.New( "Invalid PubSub subscription handler", "The handler for the subscription must be defined in the same service as the call to pubsub.NewSubscription.", errors.PrependDetails(pubsubNewSubscriptionHelp), ) ErrTopicRefOutsideService = errRange.New( "Call to pubsub.TopicRef outside service", "pubsub.TopicRef can only be called from within a service.", ) )
View Source
var SubscriptionParser = &resourceparser.Parser{ Name: "PubSub Subscription", InterestingImports: []paths.Pkg{"encore.dev/pubsub"}, Run: func(p *resourceparser.Pass) { name := pkginfo.QualifiedName{Name: "NewSubscription", PkgPath: "encore.dev/pubsub"} spec := &parseutil.ReferenceSpec{ MinTypeArgs: 0, MaxTypeArgs: 1, Parse: parsePubSubSubscription, } parseutil.FindPkgNameRefs(p.Pkg, []pkginfo.QualifiedName{name}, func(file *pkginfo.File, name pkginfo.QualifiedName, stack []ast.Node) { parseutil.ParseReference(p, spec, parseutil.ReferenceData{ File: file, Stack: stack, ResourceFunc: name, }) }) }, }
View Source
var TopicParser = &resourceparser.Parser{ Name: "PubSub Topic", InterestingImports: []paths.Pkg{"encore.dev/pubsub"}, Run: func(p *resourceparser.Pass) { name := pkginfo.QualifiedName{Name: "NewTopic", PkgPath: "encore.dev/pubsub"} spec := &parseutil.ReferenceSpec{ MinTypeArgs: 1, MaxTypeArgs: 1, Parse: parsePubSubTopic, } parseutil.FindPkgNameRefs(p.Pkg, []pkginfo.QualifiedName{name}, func(file *pkginfo.File, name pkginfo.QualifiedName, stack []ast.Node) { parseutil.ParseReference(p, spec, parseutil.ReferenceData{ File: file, Stack: stack, ResourceFunc: name, }) }) }, }
Functions ¶
func ResolveTopicUsage ¶
func ResolveTopicUsage(data usage.ResolveData, topic *Topic) usage.Usage
Types ¶
type DeliveryGuarantee ¶
type DeliveryGuarantee int
const ( AtLeastOnce DeliveryGuarantee = iota ExactlyOnce )
type PublishUsage ¶
type Subscription ¶
type Subscription struct { AST *ast.CallExpr File *pkginfo.File Name string // The unique name of the pub sub subscription Doc string // The documentation on the pub sub subscription Topic pkginfo.QualifiedName Cfg SubscriptionConfig Handler ast.Expr // The reference to the handler function }
func (*Subscription) ASTExpr ¶
func (s *Subscription) ASTExpr() ast.Expr
func (*Subscription) End ¶
func (s *Subscription) End() token.Pos
func (*Subscription) Kind ¶
func (s *Subscription) Kind() resource.Kind
func (*Subscription) Package ¶
func (s *Subscription) Package() *pkginfo.Package
func (*Subscription) Pos ¶
func (s *Subscription) Pos() token.Pos
func (*Subscription) ResourceName ¶
func (s *Subscription) ResourceName() string
type SubscriptionConfig ¶
type Topic ¶
type Topic struct { AST *ast.CallExpr File *pkginfo.File Name string // The unique name of the pub sub topic Doc string // The documentation on the pub sub topic DeliveryGuarantee DeliveryGuarantee // What guarantees does the pub sub topic have? OrderingKey string // What field in the message type should be used to ensure First-In-First-Out (FIFO) for messages with the same key MessageType *schema.TypeDeclRef // The message type of the pub sub topic }
func (*Topic) ResourceName ¶
Click to show internal directories.
Click to hide internal directories.