logstash-integration-kafka 10.6.0-java → 10.7.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d8b40d779e91e9c05dece65249660ab5c272b6833658cbca51b977d92936f42
4
- data.tar.gz: 58323e216be645aede9f0b49c27824958b6627485bdf79a6774cd5f87b818245
3
+ metadata.gz: 166b8a4d60aaa51f4c22e6ba98f5ecf9c5991ce853c3dfa8ae15c85ad28ad4bd
4
+ data.tar.gz: 1fb417190daa76b08596d8c35df7004b0f1ea284eff347ab7bd5eaeabd004e0d
5
5
  SHA512:
6
- metadata.gz: 0f05eec028758745a2ab04b90d721128c088c46d0bb9a01923c389118c99a718a561d2ca2420fc2e206e4cf75e4e3695e1704a17d9eff9f4f18e66da3d3ccb85
7
- data.tar.gz: 85e117a64d14d013674869ccadfb5487a04991ec83c6a9d6874496b862be200bf4e7203d3ac4fc779d67131ecbe82212fafd66884114337d17ed33dda7ad0963
6
+ metadata.gz: 25150a143b4ccd2375572697df7bafadc87b35930f11e9916a7db1a25a69830ab1e3ae4a2d32119bc127c81af557af277188ef705fed24d1c8f1929e5bc1e73d
7
+ data.tar.gz: 845de0baed1db54a6ec2901b92665deca90a21f40b00400a5ae5490d6355f3771048547b158dbe19b8c7ac66587398640052c6295546793ee95251df276e35af
@@ -1,3 +1,7 @@
1
+ ## 10.7.0
2
+ - Switched use from Faraday to Manticore as HTTP client library to access Schema Registry service
3
+ to fix issue [#63](https://github.com/logstash-plugins/logstash-integration-kafka/issue/63)
4
+
1
5
  ## 10.6.0
2
6
  - Added functionality to Kafka input to use Avro deserializer in retrieving data from Kafka. The schema is retrieved
3
7
  from an instance of Confluent's Schema Registry service [#51](https://github.com/logstash-plugins/logstash-integration-kafka/pull/51)
@@ -4,7 +4,7 @@ require 'stud/interval'
4
4
  require 'java'
5
5
  require 'logstash-integration-kafka_jars.rb'
6
6
  require 'logstash/plugin_mixins/kafka_support'
7
- require "faraday"
7
+ require 'manticore'
8
8
  require "json"
9
9
  require "logstash/json"
10
10
  require_relative '../plugin_mixins/common'
@@ -45,20 +45,21 @@ module LogStash
45
45
 
46
46
  private
47
47
  def check_for_schema_registry_connectivity_and_subjects
48
- client = Faraday.new(@schema_registry_url.to_s) do |conn|
49
- if schema_registry_proxy && !schema_registry_proxy.empty?
50
- conn.proxy = schema_registry_proxy.to_s
51
- end
52
- if schema_registry_key and !schema_registry_key.empty?
53
- conn.basic_auth(schema_registry_key, schema_registry_secret.value)
54
- end
48
+ options = {}
49
+ if schema_registry_proxy && !schema_registry_proxy.empty?
50
+ options[:proxy] = schema_registry_proxy.to_s
55
51
  end
52
+ if schema_registry_key and !schema_registry_key.empty?
53
+ options[:auth] = {:user => schema_registry_key, :password => schema_registry_secret.value}
54
+ end
55
+ client = Manticore::Client.new(options)
56
+
56
57
  begin
57
- response = client.get('/subjects')
58
- rescue Faraday::Error => e
58
+ response = client.get(@schema_registry_url.to_s + '/subjects').body
59
+ rescue Manticore::ManticoreException => e
59
60
  raise LogStash::ConfigurationError.new("Schema registry service doesn't respond, error: #{e.message}")
60
61
  end
61
- registered_subjects = JSON.parse response.body
62
+ registered_subjects = JSON.parse response
62
63
  expected_subjects = @topics.map { |t| "#{t}-value"}
63
64
  if (expected_subjects & registered_subjects).size != expected_subjects.size
64
65
  undefined_topic_subjects = expected_subjects - registered_subjects
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-kafka'
3
- s.version = '10.6.0'
3
+ s.version = '10.7.0'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Integration with Kafka - input and output plugins"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.add_runtime_dependency 'logstash-codec-json'
47
47
  s.add_runtime_dependency 'logstash-codec-plain'
48
48
  s.add_runtime_dependency 'stud', '>= 0.0.22', '< 0.1.0'
49
+ s.add_runtime_dependency "manticore", '>= 0.5.4', '< 1.0.0'
49
50
 
50
51
  s.add_development_dependency 'logstash-devutils'
51
52
  s.add_development_dependency 'rspec-wait'
@@ -3,7 +3,7 @@ require "logstash/devutils/rspec/spec_helper"
3
3
  require "logstash/inputs/kafka"
4
4
  require "rspec/wait"
5
5
  require "stud/try"
6
- require "faraday"
6
+ require "manticore"
7
7
  require "json"
8
8
 
9
9
  # Please run kafka_test_setup.sh prior to executing this integration test.
@@ -164,11 +164,11 @@ describe "schema registry connection options" do
164
164
 
165
165
  before(:each) do
166
166
  response = save_avro_schema_to_schema_registry(File.join(Dir.pwd, "spec", "unit", "inputs", "avro_schema_fixture_payment.asvc"), SUBJECT_NAME)
167
- expect( response.status ).to be(200)
167
+ expect( response.code ).to be(200)
168
168
  end
169
169
 
170
170
  after(:each) do
171
- schema_registry_client = Faraday.new('http://localhost:8081')
171
+ schema_registry_client = Manticore::Client.new
172
172
  delete_remote_schema(schema_registry_client, SUBJECT_NAME)
173
173
  end
174
174
 
@@ -187,26 +187,26 @@ end
187
187
  def save_avro_schema_to_schema_registry(schema_file, subject_name)
188
188
  raw_schema = File.readlines(schema_file).map(&:chomp).join
189
189
  raw_schema_quoted = raw_schema.gsub('"', '\"')
190
- response = Faraday.post("http://localhost:8081/subjects/#{subject_name}/versions",
191
- '{"schema": "' + raw_schema_quoted + '"}',
192
- "Content-Type" => "application/vnd.schemaregistry.v1+json")
190
+ response = Manticore.post("http://localhost:8081/subjects/#{subject_name}/versions",
191
+ body: '{"schema": "' + raw_schema_quoted + '"}',
192
+ headers: {"Content-Type" => "application/vnd.schemaregistry.v1+json"})
193
193
  response
194
194
  end
195
195
 
196
196
  def delete_remote_schema(schema_registry_client, subject_name)
197
- expect(schema_registry_client.delete("/subjects/#{subject_name}").status ).to be(200)
198
- expect(schema_registry_client.delete("/subjects/#{subject_name}?permanent=true").status ).to be(200)
197
+ expect(schema_registry_client.delete("http://localhost:8081/subjects/#{subject_name}").code ).to be(200)
198
+ expect(schema_registry_client.delete("http://localhost:8081/subjects/#{subject_name}?permanent=true").code ).to be(200)
199
199
  end
200
200
 
201
201
  # AdminClientConfig = org.alpache.kafka.clients.admin.AdminClientConfig
202
202
 
203
203
  describe "Schema registry API", :integration => true do
204
204
 
205
- let(:schema_registry) { Faraday.new('http://localhost:8081') }
205
+ let(:schema_registry) { Manticore::Client.new }
206
206
 
207
207
  context 'listing subject on clean instance' do
208
208
  it "should return an empty set" do
209
- subjects = JSON.parse schema_registry.get('/subjects').body
209
+ subjects = JSON.parse schema_registry.get('http://localhost:8081/subjects').body
210
210
  expect( subjects ).to be_empty
211
211
  end
212
212
  end
@@ -214,30 +214,30 @@ describe "Schema registry API", :integration => true do
214
214
  context 'send a schema definition' do
215
215
  it "save the definition" do
216
216
  response = save_avro_schema_to_schema_registry(File.join(Dir.pwd, "spec", "unit", "inputs", "avro_schema_fixture_payment.asvc"), "schema_test_1")
217
- expect( response.status ).to be(200)
217
+ expect( response.code ).to be(200)
218
218
  delete_remote_schema(schema_registry, "schema_test_1")
219
219
  end
220
220
 
221
221
  it "delete the schema just added" do
222
222
  response = save_avro_schema_to_schema_registry(File.join(Dir.pwd, "spec", "unit", "inputs", "avro_schema_fixture_payment.asvc"), "schema_test_1")
223
- expect( response.status ).to be(200)
223
+ expect( response.code ).to be(200)
224
224
 
225
- expect( schema_registry.delete('/subjects/schema_test_1?permanent=false').status ).to be(200)
225
+ expect( schema_registry.delete('http://localhost:8081/subjects/schema_test_1?permanent=false').code ).to be(200)
226
226
  sleep(1)
227
- subjects = JSON.parse schema_registry.get('/subjects').body
227
+ subjects = JSON.parse schema_registry.get('http://localhost:8081/subjects').body
228
228
  expect( subjects ).to be_empty
229
229
  end
230
230
  end
231
231
 
232
232
  context 'use the schema to serialize' do
233
233
  after(:each) do
234
- expect( schema_registry.delete('/subjects/topic_avro-value').status ).to be(200)
234
+ expect( schema_registry.delete('http://localhost:8081/subjects/topic_avro-value').code ).to be(200)
235
235
  sleep 1
236
- expect( schema_registry.delete('/subjects/topic_avro-value?permanent=true').status ).to be(200)
236
+ expect( schema_registry.delete('http://localhost:8081/subjects/topic_avro-value?permanent=true').code ).to be(200)
237
237
 
238
238
  Stud.try(3.times, [StandardError, RSpec::Expectations::ExpectationNotMetError]) do
239
239
  wait(10).for do
240
- subjects = JSON.parse schema_registry.get('/subjects').body
240
+ subjects = JSON.parse schema_registry.get('http://localhost:8081/subjects').body
241
241
  subjects.empty?
242
242
  end.to be_truthy
243
243
  end
@@ -299,7 +299,7 @@ describe "Schema registry API", :integration => true do
299
299
  delete_topic_if_exists avro_topic_name
300
300
  write_some_data_to avro_topic_name
301
301
 
302
- subjects = JSON.parse schema_registry.get('/subjects').body
302
+ subjects = JSON.parse schema_registry.get('http://localhost:8081/subjects').body
303
303
  expect( subjects ).to contain_exactly("topic_avro-value")
304
304
 
305
305
  num_events = 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.6.0
4
+ version: 10.7.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +106,26 @@ dependencies:
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 0.1.0
109
+ - !ruby/object:Gem::Dependency
110
+ requirement: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 0.5.4
115
+ - - "<"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0
118
+ name: manticore
119
+ prerelease: false
120
+ type: :runtime
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 0.5.4
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: 1.0.0
109
129
  - !ruby/object:Gem::Dependency
110
130
  requirement: !ruby/object:Gem::Requirement
111
131
  requirements: