logstash-output-torquebox 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/lib/logstash/outputs/torquebox.rb +77 -0
- data/logstash-output-torquebox.gemspec +30 -0
- data/spec/logstash/output/torquebox_spec.rb +5 -0
- data/spec/spec_helper.rb +2 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57bce12a37dffe13cf4557c1a3e6210c926327b6
|
4
|
+
data.tar.gz: f0a43b032b88d1535d781e7c8a18b4677c616b97
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e147f4c39da4f5fd31ade540a7c088aca7ed5566457a200df0f9eb94b2721a533cd048f28cf4e3988b240cea1b2b644cf5a3000cebed08fbcc0ae4002f44f45
|
7
|
+
data.tar.gz: 8d482885d78b6199bd49935e3db63029aca48d3f4779b9b5e6b054688ff407fa00ed23b6b44db0f8ae0182af138383061f4b0901e71bc91cc989c4cda4799551
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Michael Zaccari
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Logstash::Output::Torquebox
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/logstash/output/torquebox`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'logstash-output-torquebox'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install logstash-output-torquebox
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/logstash-output-torquebox.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'logstash/outputs/base'
|
3
|
+
require 'logstash/namespace'
|
4
|
+
|
5
|
+
class LogStash::Outputs::Torquebox < LogStash::Outputs::Base
|
6
|
+
|
7
|
+
config_name 'torquebox'
|
8
|
+
|
9
|
+
# Address of the TorqueBox HornetQ host to connect to
|
10
|
+
config :host, validate: :string, default: '0.0.0.0'
|
11
|
+
|
12
|
+
# Port on the TorqueBox HornetQ host to connect to
|
13
|
+
config :port, validate: :number, default: 5445
|
14
|
+
|
15
|
+
# TorqueBox topologies:
|
16
|
+
# topic - Publish / Subscribe
|
17
|
+
# queue - Producer / Consumer
|
18
|
+
#
|
19
|
+
# For more information, see:
|
20
|
+
# http://torquebox.org/documentation/3.1.2/messaging.html
|
21
|
+
config :topology, validate: ['topic', 'queue'], required: true
|
22
|
+
|
23
|
+
# The name of the topic or queue to use
|
24
|
+
config :name, validate: :string, required: true
|
25
|
+
|
26
|
+
# Specifies the serialization encoding to use for the message. TorqueBox
|
27
|
+
# provides the following built-in encodings:
|
28
|
+
#
|
29
|
+
# :marshal - The message is encoded/decoded via Marshal, and is
|
30
|
+
# transmitted as a binary message.
|
31
|
+
# :marshal_base64 - The message is encoded/decoded via Marshal, and is
|
32
|
+
# transmitted as a base64 encoded text message. This was
|
33
|
+
# the encoding scheme used in TorqueBox 1.x.
|
34
|
+
# :json - The message is encoded/decoded via JSON, and is
|
35
|
+
# transmitted as a text message. This encoding is limited,
|
36
|
+
# and should only be used for simple messages.
|
37
|
+
# :edn - The message is encoded/decoded via the edn gem, and is
|
38
|
+
# transmitted as a text message. This encoding is most
|
39
|
+
# convenient for messages that can be represented using
|
40
|
+
# standard Clojure data structures.
|
41
|
+
# :text - The message isn't encoded/decoded at all, and is passed
|
42
|
+
# straight through as a text message. The content of the
|
43
|
+
# message must be a string.
|
44
|
+
config :encoding, validate: ['marshal', 'marshal_base64', 'json', 'edn', 'text'], default: 'marshal'
|
45
|
+
|
46
|
+
# The maximum time to wait for the destination to become ready on initial app
|
47
|
+
# startup, in milliseconds. On a very slow machine this may need to be increased
|
48
|
+
# from the default.
|
49
|
+
config :startup_timeout, validate: :number, default: 500
|
50
|
+
|
51
|
+
def register
|
52
|
+
require 'torquebox-messaging'
|
53
|
+
|
54
|
+
@publish_opts = { encoding: @encoding, startup_timeout: @startup_timeout }
|
55
|
+
|
56
|
+
@logger.info "TorqueBox #{@topology}:#{@name}@#{@host}:#{@port} - #{@publish_opts}"
|
57
|
+
|
58
|
+
if @topology == 'topic'
|
59
|
+
@destination = TorqueBox::Messaging::Topic.new(@name, host: @host, port: @port)
|
60
|
+
else
|
61
|
+
@destination = TorqueBox::Messaging::Queue.new(@name, host: @host, port: @port)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def receive(event)
|
66
|
+
@logger.debug('Sending message to destination', event: event)
|
67
|
+
|
68
|
+
begin
|
69
|
+
@destination.publish(event.to_json, @publish_opts)
|
70
|
+
rescue javax.jms.JMSException => e
|
71
|
+
@logger.error("Torquebox destination is not available", exception: e)
|
72
|
+
rescue => e
|
73
|
+
@logger.error("Failed to send event #{event}", exception: e)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'logstash-output-torquebox'
|
5
|
+
s.version = '1.0.1'
|
6
|
+
s.authors = ['Michael Zaccari']
|
7
|
+
s.email = ['michael.zaccari@accelerated.com']
|
8
|
+
|
9
|
+
s.summary = 'Push events to a TorqueBox messaging server (HornetQ)'
|
10
|
+
s.description = 'This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install logstash-output-torquebox. This gem is not a stand-alone program'
|
11
|
+
s.homepage = 'https://github.com/mzaccari/logstash-output-torquebox'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.require_paths = ['lib']
|
14
|
+
|
15
|
+
# Files
|
16
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE.txt']
|
17
|
+
|
18
|
+
# Tests
|
19
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
|
+
|
21
|
+
# Special flag to let us know this is actually a logstash plugin
|
22
|
+
s.metadata = { 'logstash_plugin' => 'true', 'logstash_group' => 'output' }
|
23
|
+
|
24
|
+
# Gem dependencies
|
25
|
+
s.add_runtime_dependency 'logstash-core-plugin-api', '~> 1.0'
|
26
|
+
s.add_runtime_dependency 'logstash-codec-plain'
|
27
|
+
s.add_runtime_dependency 'torquebox-messaging', '~> 3.1'
|
28
|
+
|
29
|
+
s.add_development_dependency 'logstash-devutils'
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-output-torquebox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Zaccari
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.0'
|
19
|
+
name: logstash-core-plugin-api
|
20
|
+
prerelease: false
|
21
|
+
type: :runtime
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
name: logstash-codec-plain
|
34
|
+
prerelease: false
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.1'
|
47
|
+
name: torquebox-messaging
|
48
|
+
prerelease: false
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
name: logstash-devutils
|
62
|
+
prerelease: false
|
63
|
+
type: :development
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install logstash-output-torquebox. This gem is not a stand-alone program
|
70
|
+
email:
|
71
|
+
- michael.zaccari@accelerated.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- Gemfile
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
79
|
+
- lib/logstash/outputs/torquebox.rb
|
80
|
+
- logstash-output-torquebox.gemspec
|
81
|
+
- spec/logstash/output/torquebox_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
homepage: https://github.com/mzaccari/logstash-output-torquebox
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata:
|
87
|
+
logstash_plugin: 'true'
|
88
|
+
logstash_group: output
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.6.4
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Push events to a TorqueBox messaging server (HornetQ)
|
109
|
+
test_files:
|
110
|
+
- spec/logstash/output/torquebox_spec.rb
|
111
|
+
- spec/spec_helper.rb
|