Skip to content

Conversation

bmcustodio
Copy link
Contributor

@bmcustodio bmcustodio commented Dec 10, 2019

Description

This PR adds support for customising the NATS Streaming channel and queue group used for asynchronous invocations, as per openfaas/faas#1399, in a backwards-compatible way.

Motivation and Context

  • I have raised an issue to propose this change (required)

openfaas/faas#1399

How Has This Been Tested?

By running the included unit tests, which is enough in this case IMHO. There's also bmcstdio/openfaas-nats-queue-worker:pr-79, just in case.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@alexellis
Copy link
Member

Please could you rebase? After your other PR was merged this needs an update.


// CreateNATSQueue ready for asynchronous processing
func CreateNATSQueue(address string, port int, clusterName string, clientConfig NATSConfig) (*NATSQueue, error) {
func CreateNATSQueue(address string, port int, clusterName, channel string, clientConfig NATSConfig) (*NATSQueue, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just like the one introduced in #71.


clientID := clientConfig.GetClientID()

// If 'channel' is empty, use the previous default.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "" a valid channel? What about throwing an error for an empty value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly has backwards-compatibility in mind. If for some reason no value for channel is provided (i.e. the faas_nats_channel environment variable is not defined), it will fall back to the previous (well, current) default without erroring out.

Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
@bmcustodio
Copy link
Contributor Author

@alexellis rebased!

@alexellis alexellis merged commit cf881e3 into openfaas:master Dec 10, 2019
@alexellis
Copy link
Member

Thanks

@alexellis
Copy link
Member

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 this pull request may close these issues.

2 participants