Method: OCI::Streaming::StreamClient#consumer_commit

Defined in:
lib/oci/streaming/stream_client.rb

#consumer_commit(stream_id, cursor, opts = {}) ⇒ Response

Provides a mechanism to manually commit offsets, if not using commit-on-get consumer semantics. This commits offsets assicated with the provided cursor, extends the timeout on each of the affected partitions, and returns an updated cursor.

Parameters:

  • stream_id (String)

    The OCID of the stream for which the group is committing offsets.

  • cursor (String)

    The group-cursor representing the offsets of the group. This cursor is retrieved from the CreateGroupCursor API call.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :retry_config (OCI::Retry::RetryConfig)

    The retry configuration to apply to this operation. If no key is provided then the service-level retry configuration defined by #retry_config will be used. If an explicit nil value is provided then the operation will not retry

  • :opc_request_id (String)

    The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.

Returns:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/oci/streaming/stream_client.rb', line 124

def consumer_commit(stream_id, cursor, opts = {})
  logger.debug 'Calling operation StreamClient#consumer_commit.' if logger

  raise "Missing the required parameter 'stream_id' when calling consumer_commit." if stream_id.nil?
  raise "Missing the required parameter 'cursor' when calling consumer_commit." if cursor.nil?
  raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)

  path = '/streams/{streamId}/commit'.sub('{streamId}', stream_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:cursor] = cursor

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#consumer_commit') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::Streaming::Models::Cursor'
    )
  end
  # rubocop:enable Metrics/BlockLength
end