Class: KafkaProxyRestClient::ProducerApi
- Inherits:
-
Object
- Object
- KafkaProxyRestClient::ProducerApi
- Defined in:
- lib/kafka_rest_proxy_client/api/producer_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ ProducerApi
constructor
A new instance of ProducerApi.
-
#topics_topic_name_post(topic_name, body, opts = {}) ⇒ InlineResponse200
(also: #publish)
Produce messages to a topic, optionally specifying keys or partitions for the messages.
-
#topics_topic_name_post_with_http_info(topic_name, body, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>
Produce messages to a topic, optionally specifying keys or partitions for the messages.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ProducerApi
Returns a new instance of ProducerApi.
7 8 9 |
# File 'lib/kafka_rest_proxy_client/api/producer_api.rb', line 7 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
5 6 7 |
# File 'lib/kafka_rest_proxy_client/api/producer_api.rb', line 5 def api_client @api_client end |
Instance Method Details
#topics_topic_name_post(topic_name, body, opts = {}) ⇒ InlineResponse200 Also known as: publish
Produce messages to a topic, optionally specifying keys or partitions for the messages. If no partition is provided, one will be chosen based on the hash of the key. If no key is provided, the partition will be chosen for each message in a round-robin fashion. # For the “avro“ embedded format, you must provide information about schemas and the REST proxy must be configured with the URL to access the schema registry (“schema.registry.connect“). Schemas may be provided as the full schema encoded as a string, or, after the initial request may be provided as the schema ID returned with the first response.
17 18 19 20 |
# File 'lib/kafka_rest_proxy_client/api/producer_api.rb', line 17 def topics_topic_name_post(topic_name, body, opts = {}) data, _status_code, _headers = topics_topic_name_post_with_http_info(topic_name, body, opts) return data end |
#topics_topic_name_post_with_http_info(topic_name, body, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>
Produce messages to a topic, optionally specifying keys or partitions for the messages. If no partition is provided, one will be chosen based on the hash of the key. If no key is provided, the partition will be chosen for each message in a round-robin fashion. # For the ``avro`` embedded format, you must provide information about schemas and the REST proxy must be configured with the URL to access the schema registry (``schema.registry.connect``). Schemas may be provided as the full schema encoded as a string, or, after the initial request may be provided as the schema ID returned with the first response.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/kafka_rest_proxy_client/api/producer_api.rb', line 29 def topics_topic_name_post_with_http_info(topic_name, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ProducerApi.topics_topic_name_post ..." end # verify the required parameter 'topic_name' is set fail ArgumentError, "Missing the required parameter 'topic_name' when calling ProducerApi.topics_topic_name_post" if topic_name.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling ProducerApi.topics_topic_name_post" if body.nil? # resource path local_var_path = "/topics/{topic_name}".sub('{format}','json').sub('{' + 'topic_name' + '}', topic_name.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/vnd.kafka.v2+json', 'application/vnd.kafka+json', 'application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/vnd.kafka.v2+json', 'application/vnd.kafka+json', 'application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InlineResponse200') if @api_client.config.debugging @api_client.config.logger.debug "API called: ProducerApi#topics_topic_name_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |