pulsar-client 2.4.1.pre.beta.1
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 +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CONTRIBUTORS.md +26 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +40 -0
- data/LICENSE +202 -0
- data/NOTICE +6 -0
- data/README.md +89 -0
- data/Rakefile +10 -0
- data/TODO.md +24 -0
- data/bin/console +8 -0
- data/bin/example-consumer +45 -0
- data/bin/example-producer +43 -0
- data/bin/setup +6 -0
- data/ext/bindings/bindings.cpp +18 -0
- data/ext/bindings/client.cpp +187 -0
- data/ext/bindings/client.hpp +56 -0
- data/ext/bindings/consumer.cpp +90 -0
- data/ext/bindings/consumer.hpp +31 -0
- data/ext/bindings/extconf.rb +3 -0
- data/ext/bindings/message.cpp +47 -0
- data/ext/bindings/message.hpp +35 -0
- data/ext/bindings/producer.cpp +69 -0
- data/ext/bindings/producer.hpp +29 -0
- data/ext/bindings/util.cpp +11 -0
- data/ext/bindings/util.hpp +16 -0
- data/lib/pulsar/client.rb +58 -0
- data/lib/pulsar/client/version.rb +24 -0
- data/lib/pulsar/client_configuration.rb +77 -0
- data/lib/pulsar/consumer.rb +51 -0
- data/lib/pulsar/consumer_configuration.rb +55 -0
- data/lib/pulsar/producer.rb +35 -0
- data/pulsar-client.gemspec +31 -0
- metadata +149 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'pulsar/client/version'
|
21
|
+
require 'pulsar/bindings'
|
22
|
+
require 'pulsar/client_configuration'
|
23
|
+
require 'pulsar/consumer'
|
24
|
+
require 'pulsar/producer'
|
25
|
+
|
26
|
+
module Pulsar
|
27
|
+
class ConsumerConfiguration
|
28
|
+
# aligns with the pulsar::ConsumerType enum in the C++ library
|
29
|
+
CONSUMER_TYPES = {
|
30
|
+
:exclusive => Pulsar::ConsumerType::Exclusive,
|
31
|
+
:shared => Pulsar::ConsumerType::Shared,
|
32
|
+
:failover => Pulsar::ConsumerType::Failover,
|
33
|
+
:key_shared => Pulsar::ConsumerType::KeyShared
|
34
|
+
}
|
35
|
+
|
36
|
+
module RubySideTweaks
|
37
|
+
def consumer_type
|
38
|
+
enum_value = super
|
39
|
+
CONSUMER_TYPES.invert[enum_value]
|
40
|
+
end
|
41
|
+
|
42
|
+
def consumer_type=(type)
|
43
|
+
unless type.is_a?(Pulsar::ConsumerType)
|
44
|
+
type = CONSUMER_TYPES[type]
|
45
|
+
unless type
|
46
|
+
raise ArgumentError, "unrecognized consumer_type"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
super(type)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
prepend RubySideTweaks
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'pulsar/bindings'
|
21
|
+
|
22
|
+
module Pulsar
|
23
|
+
class Producer
|
24
|
+
module RubySideTweaks
|
25
|
+
def send(message)
|
26
|
+
unless message.is_a?(Pulsar::Message)
|
27
|
+
message = Pulsar::Message.new(message)
|
28
|
+
end
|
29
|
+
super(message)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
prepend RubySideTweaks
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "pulsar/client/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "pulsar-client"
|
7
|
+
spec.version = Pulsar::Client::VERSION
|
8
|
+
spec.date = "2019-10-03"
|
9
|
+
spec.summary = "Apache Pulsar Ruby Client"
|
10
|
+
spec.description = "Wraps the Apache Pulsar C++ Client with Ruby bindings."
|
11
|
+
spec.authors = ["Jacob Fugal"]
|
12
|
+
spec.email = ["lukfugl@gmail.com"]
|
13
|
+
# once merged upstream to apache, we'll rename the homepage
|
14
|
+
spec.homepage = "https://github.com/instructure/pulsar-client-ruby"
|
15
|
+
spec.license = "Apache-2.0"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
|
23
|
+
spec.extensions = ["ext/bindings/extconf.rb"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
|
29
|
+
spec.add_dependency "rake-compiler", "~> 1.0"
|
30
|
+
spec.add_dependency "rice", "~> 2.1"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pulsar-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.4.1.pre.beta.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jacob Fugal
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-compiler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rice
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.1'
|
83
|
+
description: Wraps the Apache Pulsar C++ Client with Ruby bindings.
|
84
|
+
email:
|
85
|
+
- lukfugl@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions:
|
88
|
+
- ext/bindings/extconf.rb
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- CONTRIBUTORS.md
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE
|
98
|
+
- NOTICE
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- TODO.md
|
102
|
+
- bin/console
|
103
|
+
- bin/example-consumer
|
104
|
+
- bin/example-producer
|
105
|
+
- bin/setup
|
106
|
+
- ext/bindings/bindings.cpp
|
107
|
+
- ext/bindings/client.cpp
|
108
|
+
- ext/bindings/client.hpp
|
109
|
+
- ext/bindings/consumer.cpp
|
110
|
+
- ext/bindings/consumer.hpp
|
111
|
+
- ext/bindings/extconf.rb
|
112
|
+
- ext/bindings/message.cpp
|
113
|
+
- ext/bindings/message.hpp
|
114
|
+
- ext/bindings/producer.cpp
|
115
|
+
- ext/bindings/producer.hpp
|
116
|
+
- ext/bindings/util.cpp
|
117
|
+
- ext/bindings/util.hpp
|
118
|
+
- lib/pulsar/client.rb
|
119
|
+
- lib/pulsar/client/version.rb
|
120
|
+
- lib/pulsar/client_configuration.rb
|
121
|
+
- lib/pulsar/consumer.rb
|
122
|
+
- lib/pulsar/consumer_configuration.rb
|
123
|
+
- lib/pulsar/producer.rb
|
124
|
+
- pulsar-client.gemspec
|
125
|
+
homepage: https://github.com/instructure/pulsar-client-ruby
|
126
|
+
licenses:
|
127
|
+
- Apache-2.0
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.3.1
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.6.14
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Apache Pulsar Ruby Client
|
149
|
+
test_files: []
|