changed CHANGELOG.md
 
@@ -6,6 6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [Unreleased]
8
8
9
## [0.7.1] - 2022-05-09
10
11
### Added
12
13
- Add `:receive_timeout` option
14
9
15
## [0.7.0] - 2021-08-30
10
16
11
17
### Changed
changed hex_metadata.config
 
@@ -6,8 6,8 @@
6
6
[<<"lib">>,<<"lib/broadway_cloud_pub_sub">>,
7
7
<<"lib/broadway_cloud_pub_sub/client.ex">>,
8
8
<<"lib/broadway_cloud_pub_sub/producer.ex">>,
9
- <<"lib/broadway_cloud_pub_sub/acknowledger.ex">>,
10
- <<"lib/broadway_cloud_pub_sub/google_api_client.ex">>,<<".formatter.exs">>,
9
<<"lib/broadway_cloud_pub_sub/google_api_client.ex">>,
10
<<"lib/broadway_cloud_pub_sub/acknowledger.ex">>,<<".formatter.exs">>,
11
11
<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,<<"CHANGELOG.md">>]}.
12
12
{<<"licenses">>,[<<"Apache-2.0">>]}.
13
13
{<<"links">>,
 
@@ -34,4 34,4 @@
34
34
{<<"optional">>,true},
35
35
{<<"repository">>,<<"hexpm">>},
36
36
{<<"requirement">>,<<"~> 1.0">>}]]}.
37
- {<<"version">>,<<"0.7.0">>}.
37
{<<"version">>,<<"0.7.1">>}.
changed lib/broadway_cloud_pub_sub/google_api_client.ex
 
@@ -25,6 25,7 @@ defmodule BroadwayCloudPubSub.GoogleApiClient do
25
25
@behaviour Client
26
26
27
27
@default_max_number_of_messages 10
28
@default_receive_timeout :infinity
28
29
29
30
@default_scope "https://www.googleapis.com/auth/pubsub"
30
31
 
@@ -75,7 76,8 @@ defmodule BroadwayCloudPubSub.GoogleApiClient do
75
76
def init(opts) do
76
77
with {:ok, subscription} <- validate_subscription(opts),
77
78
{:ok, token_generator} <- validate_token_opts(opts),
78
- {:ok, pull_request} <- validate_pull_request(opts) do
79
{:ok, pull_request} <- validate_pull_request(opts),
80
{:ok, receive_timeout} <- validate(opts, :receive_timeout, @default_receive_timeout) do
79
81
adapter = Keyword.get(opts, :__internal_tesla_adapter__, Hackney)
80
82
connection_pool = Keyword.get(opts, :__connection_pool__, :default)
81
83
 
@@ -92,7 94,8 @@ defmodule BroadwayCloudPubSub.GoogleApiClient do
92
94
connection_pool: connection_pool,
93
95
subscription: subscription,
94
96
token_generator: token_generator,
95
- pull_request: pull_request
97
pull_request: pull_request,
98
receive_timeout: receive_timeout
96
99
}
97
100
98
101
{:ok, config}
 
@@ -104,7 107,7 @@ defmodule BroadwayCloudPubSub.GoogleApiClient do
104
107
pull_request = put_max_number_of_messages(opts.pull_request, demand)
105
108
106
109
opts
107
- |> conn!(recv_timeout: :infinity)
110
|> conn!(recv_timeout: opts.receive_timeout)
108
111
|> pubsub_projects_subscriptions_pull(
109
112
opts.subscription.projects_id,
110
113
opts.subscription.subscriptions_id,
 
@@ -241,6 244,11 @@ defmodule BroadwayCloudPubSub.GoogleApiClient do
241
244
defp validate_option(:return_immediately, value) when not is_boolean(value),
242
245
do: validation_error(:return_immediately, "a boolean value", value)
243
246
247
defp validate_option(:receive_timeout, :infinity), do: {:ok, :infinity}
248
249
defp validate_option(:receive_timeout, value) when not is_integer(value) or value < 0,
250
do: validation_error(:receive_timeout, "a non-negative integer or :infinity", value)
251
244
252
defp validate_option(_, value), do: {:ok, value}
245
253
246
254
defp validation_error(option, expected, value) do
changed lib/broadway_cloud_pub_sub/producer.ex
 
@@ -46,6 46,9 @@ defmodule BroadwayCloudPubSub.Producer do
46
46
* `:middleware` - Optional. List of custom Tesla middleware
47
47
Example: `[{Tesla.Middleware.BaseUrl, "https://example.com"}]`
48
48
49
* `:receive_timeout` - Optional. The maximum time to wait for a response before
50
the pull client returns an error. Defaults to `:infinity`.
51
49
52
### Custom token generator
50
53
51
54
A custom token generator can be given as a MFArgs tuple.
changed mix.exs
 
@@ -1,7 1,7 @@
1
1
defmodule BroadwayCloudPubSub.MixProject do
2
2
use Mix.Project
3
3
4
- @version "0.7.0"
4
@version "0.7.1"
5
5
@description "A Google Cloud Pub/Sub connector for Broadway"
6
6
@repo_url "https://github.com/dashbitco/broadway_cloud_pub_sub"