Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample code on readme does not compile #1456

Open
myles-mcdonnell opened this issue Feb 14, 2021 · 1 comment
Open

Sample code on readme does not compile #1456

myles-mcdonnell opened this issue Feb 14, 2021 · 1 comment

Comments

@myles-mcdonnell
Copy link

myles-mcdonnell commented Feb 14, 2021

Seems that frugal.NewFNatsScopeTransportFactory as referenced on the root README does not exist anymore.

I'll raise a PR with the fix once I have worked it out but currently stuck at what thrift go package version I need to compile the gen code.

@myles-mcdonnell
Copy link
Author

myles-mcdonnell commented Feb 14, 2021

I have resolved this by instantiating both a FNatsSubscriberTransportFactory and a FNatsPublisherTransportFactory but I haven't raised a PR as this seems wrong to create both pub and sub transport factories in the pub and sub? Maybe not though as it does that in the example code?

var (
   protocolFactory            = frugal.NewFProtocolFactory(thrift.NewTBinaryProtocolFactoryDefault())
   subscriberTransportFactory = frugal.NewFNatsSubscriberTransportFactory(conn)
   publisherTransportFactory  = frugal.NewFNatsPublisherTransportFactory(conn)
   provider  = frugal.NewFScopeProvider(
			publisherTransportFactory,
			subscriberTransportFactory,
			protocolFactory)
   subscriber = event.NewEventsSubscriber(provider)
)

Also the function signature for SubscribeEventCreated now takes frugal.FContext not a pointer to that type:

_, err = subscriber.SubscribeEventCreated(func(ctx frugal.FContext, e *event.Event) {
   fmt.Println("Received event:", e.Message)
})

Hope this is helpful in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant