Changes the MongoDB state store to detect if it's connected to a replica set.
- When performing BulkSet or BulkDelete operations and connected to a replica set, uses a transaction to perform the operations more correctly (atomically) and faster
- When performing transactions, return an error if not connected to a replica set (the operation would fail, but this short-circuits the effort)
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Propagates contexts to callers where appropriate.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Updates units tests with new func signature
Signed-off-by: joshvanl <me@joshvanl.dev>
* Fix linting errors
Signed-off-by: joshvanl <me@joshvanl.dev>
* Add atomic gate to alicloud rocketmq close channel.
Signed-off-by: joshvanl <me@joshvanl.dev>
* bindings/aws/kinesis use a separate ctx variable name
Signed-off-by: joshvanl <me@joshvanl.dev>
* binding/kafka: use atomic to prevent closing the channel twice
Signed-off-by: joshvanl <me@joshvanl.dev>
* bindings/mqtt3: use atomic bool to prevent close channel being closed multiple times
Signed-off-by: joshvanl <me@joshvanl.dev>
* bindings/mqtt3: use Background context for handle operations:w
Signed-off-by: joshvanl <me@joshvanl.dev>
* state/cocroachdb: add context to Ping()
Signed-off-by: joshvanl <me@joshvanl.dev>
* bindings/postgres: add comment explaining use of context.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Adds comment header to health/pinger.go
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/aws/snssqs: add waitgroup to wait for all go routines to finish
and block on Close(). Shuts down the subscription if there are no topic
handlers.
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/mqtt3: add atomic bool to prevent multiple channel closes. Add
wait group to block close on all goroutines to finish.
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/rabbitmq: fixes race conditions, uses atomic to prevent multiple
closes, add wait group to block close on all goroutines
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/redis: revert ctx passed when it could be cancelled. Add wait
group wait when closing.
Signed-off-by: joshvanl <me@joshvanl.dev>
* state/postges: pass context in init, and wait group on close.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Update all `Ping()` to `PingContext()` where possible.
Signed-off-by: joshvanl <me@joshvanl.dev>
* state/in-memory: add atomic bool to prevent closing channel multiple
times. Add wait group to block on close()
Signed-off-by: joshvanl <me@joshvanl.dev>
* state/mysql: don't use same ctx variable name
Signed-off-by: joshvanl <me@joshvanl.dev>
* Pass correct loop context to redis go routines
Signed-off-by: joshvanl <me@joshvanl.dev>
* Rename context when creating timeouts in state
Signed-off-by: joshvanl <me@joshvanl.dev>
* Remove state.Features() from requiring a context
Signed-off-by: joshvanl <me@joshvanl.dev>
* Revert wasm request handle Close func to be without context to
implement io.Closer interface. Add 5 second timeout. Add io.Closer
assertion in test.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Remove superfluous go lint vet directive
Signed-off-by: joshvanl <me@joshvanl.dev>
* Change Configuration Init function to take context
Signed-off-by: joshvanl <me@joshvanl.dev>
* Updates input binding interface to include a `Close() error` function. `Close`
blocks until all resources have been released and go routines have returned.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Change `Close() error` in input binding struct to `io.Closer` interface.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Update go.mod files to point to dapr/dapr PR https://github.com/dapr/dapr/pull/5831
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/redis: watch closeCh to shutdown worker instead of init context.
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/aws/snssqs + bindings/kubemq: ensure closeCh is caught so Close
correctly returns
Signed-off-by: joshvanl <me@joshvanl.dev>
* Close kubemq binding client on close. Ensure kafka consumer channel
cannot be closed more than once.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Tweaks
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Fixed cert tests
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* binding/mqtt3: add inline Background context instead of passing to
handleMessage
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/mqtt3: remove context from createSubscriberClientOptions
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/mqtt3: Remove `ResetConnection` func
Signed-off-by: joshvanl <me@joshvanl.dev>
* pubsub/kafka: Don't resubscribe if Subscribe is cancelled.
Signed-off-by: joshvanl <me@joshvanl.dev>
* binding/mqtt3: don't use context to control establishing connection
Signed-off-by: joshvanl <me@joshvanl.dev>
* bindings/mqtt3: Fix linting errors
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
* Go 1.19 support and linter fixes
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Update workflows for Go1.19 and new linter version
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Remove unnecessary space in nolint directive
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* disable additional linters which aren't used because of Go generics
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* enable gosec linter again
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Update bindings/zeebe/command/publish_message_test.go
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Update bindings/output_binding.go
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Use prepared statement for mysql table creation
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Ping is not ping
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* c'mon linter
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Fix MySQL gosec issue
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* revert mysql to be fixed later
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* Update readme of bindings (#1690)
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
Co-authored-by: Looong Dai <long.dai@intel.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Fixing includedHeaders problem with spaces (#1610)
Signed-off-by: Ben Kotvis <kotvisbj@gmail.com>
Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Co-authored-by: Looong Dai <long.dai@intel.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Simplify vault token read (#1560)
* Simplify vault token get
Signed-off-by: zhangchao <zchao9100@gmail.com>
* fix lint
Signed-off-by: zhangchao <zchao9100@gmail.com>
* update tests
Signed-off-by: zhangchao <zchao9100@gmail.com>
Co-authored-by: Looong Dai <long.dai@intel.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Signed-off-by: Eddie <eddie@wassef.com>
* GH-1609 : Fix for MongoDB Atlas conn strings
Added recommended fix in the issue
Signed-off-by: Eddie <eddie@wassef.com>
* updating the comment based on PR feedback
Signed-off-by: Eddie <eddie@wassef.com>
* Initial Certification test for eventhubs binding [incomplete] (#1670)
* certification test for eventhubs binding
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
* modified go.mod and go.sum
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
* Add connection string testing
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
* iothub testing
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
* address feedback and run test
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
* Install Azure CLI IOT hub extension
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* make modtidy-all
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
* covering all eventhubs test cases
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
* dependency changes after go modtidy-all
Signed-off-by: tanvigour <tanvi.gour@gmail.com>
Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Looong Dai <long.dai@intel.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Use revive instead of golint (#1685)
Signed-off-by: pigletfly <wangbing.adam@gmail.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Updated to Go 1.18 (#1697)
* Updated to Go 1.18
Signed-off-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
* Added go.work file
With Go 1.18, this allows gopls (the Go language server used for example in VS Code) to work inside test apps too.
See: https://go.dev/doc/tutorial/workspaces
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Removed go.work
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* 💄
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Add metadata property to configure Batching in Pulsar (#1707)
* Add metadata property to configure BatchingMaxSize&batchingMaxMessages in Pulsar
Signed-off-by: saberwang <saberwang@hotmail.com>
* sort field
Signed-off-by: saberwang <saberwang@hotmail.com>
* [pubsub]fix unit test bug
Signed-off-by: saberwang <saberwang@hotmail.com>
* remove unrelated changes
Signed-off-by: saberwang <saberwang@hotmail.com>
* Delete hard coded Metadata
Signed-off-by: saberwang <saberwang@hotmail.com>
* remove .history
Signed-off-by: saberwang <saberwang@hotmail.com>
* restore .gitignore
Signed-off-by: saberwang <saberwang@hotmail.com>
* Hard coding default values and adding 'BatchingMaxPublishDelay' metadata
Signed-off-by: saberwang <saberwang@hotmail.com>
* fix code format
Signed-off-by: saberwang <saberwang@hotmail.com>
* formatting code
Signed-off-by: saberwang <saberwang@hotmail.com>
Co-authored-by: Looong Dai <long.dai@intel.com>
Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Fix 4529: Ignore Subscribe/Get wrong redis configuration type keys. (#1693)
* fix: 4529
Signed-off-by: LaurenceLiZhixin <382673304@qq.com>
* Fix: add test does not throw error for wrong type during get all test case of redis configuration
Signed-off-by: LaurenceLiZhixin <382673304@qq.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Ian Luo <ian.luo@gmail.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Signed-off-by: Eddie Wassef <eddie@wassef.com>
Fixing leading newline in linter error
Signed-off-by: Eddie <eddie@wassef.com>
* Implment a secret store based on Huawei CSMS (#1710)
Signed-off-by: Chen Cong <chock-cong.chen@outlook.com>
Co-authored-by: Chen Cong <chock-cong.chen@outlook.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Add yet another missing secret to eventhub binding cert test (#1713)
Signed-off-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Support custom queueEndpoint in Azure Storage Queues (#1692)
* Support custom queueEndpoint in Azure Storage Queues
Signed-off-by: Janusz Dziurzynski <janusz@corechain.tech>
* run gofmt
Signed-off-by: Janusz Dziurzynski <janusz@corechain.tech>
* Add "Url" to JSON field name for clarity
Suggested by @msfussell in dapr/docs#2424
Signed-off-by: Janusz Dziurzynski <janusz@corechain.tech>
Signed-off-by: Eddie <eddie@wassef.com>
* Refactory kafka binding to reuse the kafka common code extracting from kafka pubsub component (#1696)
* refactory kafka pubsub code to extract common kafka code for reuse
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* fix lint;add unit test for subscribeAdapter
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* move topics filed from internal kafak struct to pubsub kafka struct, since in input binding the topics will confiured in metadata
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* reuse internal kafka code for bindings
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* add redis standalone_test back which is delete by mistaken
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* small code improvement to trigger test
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* add license headers
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* try to set disbaleTls to true to verify the kafka connection fail
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* don't enable consum retry in kafka binding component;if authenticaion is disabled, need not set TLSDisable at the same time;
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
* fix lint
Signed-off-by: Sky Ao <aoxiaojian@gmail.com>
Co-authored-by: Loong Dai <long.dai@intel.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Add topic metadata for mqtt input binding and support user defined topic for mqtt output binding (#1674)
* feat(bindings/mqtt): add data incoming topic to metadata
Signed-off-by: lotuc <lotu.c@outlook.com>
* feat(bindings/mqtt): support user defined topic on create action
Signed-off-by: lotuc <lotu.c@outlook.com>
* chore(bindings/mqtt): add integration test and topic response check test
Signed-off-by: lotuc <lotu.c@outlook.com>
* fix(bindings/mqtt): ignore misspell linting error for word mosquitto
Signed-off-by: lotuc <lotu.c@outlook.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Signed-off-by: Eddie <eddie@wassef.com>
* Expire -> ExpiryInSeconds (#1721)
Signed-off-by: seeflood <349895584@qq.com>
Signed-off-by: Eddie <eddie@wassef.com>
* running gofmt -s -w state/mongodb/mongodb.go
Signed-off-by: Eddie <eddie@wassef.com>
* Update mongodb.go
Co-authored-by: Wang Bing <wangbing.adam@gmail.com>
Co-authored-by: Looong Dai <long.dai@intel.com>
Co-authored-by: Ben Kotvis <kotvisbj@gmail.com>
Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Co-authored-by: Taction <zchao9100@gmail.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: tanvigour <60332928+tanvigour@users.noreply.github.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: saber-wang <45062099+saber-wang@users.noreply.github.com>
Co-authored-by: Laurence <45508533+LaurenceLiZhixin@users.noreply.github.com>
Co-authored-by: Ian Luo <ian.luo@gmail.com>
Co-authored-by: Chock Chen <46557936+ChenCong0207@users.noreply.github.com>
Co-authored-by: Chen Cong <chock-cong.chen@outlook.com>
Co-authored-by: Janusz Dziurzynski <janusz@forserial.org>
Co-authored-by: Sky Ao <aoxiaojian@gmail.com>
Co-authored-by: lotuc <lotu.c@outlook.com>
Co-authored-by: seeflood <349895584@qq.com>
* add `Ping` operation.
* add `Ping` implementation of GA components
* add context to an argument for Ping
* add `Ping` implementation of blobstorage
* fix error string for passing lint
* Update blobstorage.go
Co-authored-by: Artur Souza <artursouza.ms@outlook.com>
* Add ETag operation to statestore conformance test
ETags are used to enable concurrency guarantees and are part of the
statestore specification. Not all stores need to use them, however
if the store chooses to, it should be part of the certification
process. This commit adds a simple ETag test scenario that verifies
the basic behaviors of ETags.
https://github.com/dapr/components-contrib/issues/711
* Update tests.yml
* Error on mongodb when etag does not match on delete.
Co-authored-by: Artur Souza <artursouza.ms@outlook.com>
* Add state transaction conf test.
* Does not return error for key not found in mongodb.
* Rewrite state conf test.
* Handle []byte in cosmosdb state txn (#664)
Fixes: dapr/dotnet-sdk#579
The issue here is that we had missed the case of pre-marshaled bytes in
the state transaction code path, which would result in the encoding/json
package doing it's normal thing and base64 encoding the data as a JSON
string.
The fix is to use json.RawMessage to avoid that. Turns out this code can
be simplified a bit.
* Fix cosmosdb handling of byte[].
* Fix lint.
* Fix UT for cosmosdb.
* Remove config from state store conf test.
Co-authored-by: Ryan Nowak <nowakra@gmail.com>
* add BulkGet method on state store
* add a bool value in bulk get method to tell dapr if this store supports bulk get or not
* add BulkGetResponse for bulk get; rollback GetResponse to remove new added filed key
* update to use BulkGetResponse for bulk get
* fix lint issues
* fix lint issues
* fix lnit issues