mmonad 0.0.0.pre → 0.0.1.p2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +94 -0
  3. data/lib/m_monad.rb +1 -3
  4. data/lib/version.rb +3 -3
  5. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 289e0bed47ec57709b0da562d947db420b6e5d44
4
- data.tar.gz: 4b973ab60f7efcac727fc72d20f794db8797c7b1
3
+ metadata.gz: cb11907403ea9a8b1c443a69142b5aebe3439b5f
4
+ data.tar.gz: 625206acc0e8a2286e74b825e0d8b637ed549e94
5
5
  SHA512:
6
- metadata.gz: 0b455fbf907d690d8a1858f43a7db4d87b5952ae58a7588ac713b40009c7434cf92248d7c899e498eeb93eb44b58ea4e139b95e3a38e7624dd623b02907936cf
7
- data.tar.gz: da9187f248e9f83bf9f2a5ec7c14e6ba6081db593a5ea40c4a9bdd1d095257f5241aaa6fbb48131ad83a2688748d19570d5d7ea50dfa458997517e13116181cb
6
+ metadata.gz: 0f9eb8e439dd2f927c5add0b869c9386008b8e493b422df218e9bcf172339e98ff86d72196d068dc57c08d4f9937362c7351cf919e2a53102900a6c44363f4ec
7
+ data.tar.gz: cb385b6e5914a84954e67d634637bdaee863e368a773db838e0db0018fc2f7409885d49bb442fac5ed0a7281fa14c1b0d6a3c5fab8d2e47561aa69df69ff8669
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ [![Gem Version](https://badge.fury.io/rb/mmonad.svg)](https://badge.fury.io/rb/mmonad)
2
+ [![CircleCI](https://circleci.com/gh/Jared-Prime/mmonad.svg?style=svg)](https://circleci.com/gh/Jared-Prime/mmonad)
3
+
4
+ # MMonad
5
+
6
+ Messaging Monad, backed by 0MQ
7
+
8
+ ## Purpose
9
+
10
+ `MMonad` provides a DSL for sending and receiving messages through 0MQ sockets.
11
+
12
+ ## Installation Requirements
13
+
14
+ 1. 0MQ
15
+ - `libzmq` ZeroMQ core engine in C++, implements ZMTP/3.0 https://github.com/zeromq/libzmq
16
+ - `czmq` High-level C binding for ØMQ https://github.com/zeromq/czmq
17
+ 2. Ruby
18
+ - `2.4.2` minimum supported. [`rbenv` is the recommended Ruby install tool](https://github.com/rbenv/rbenv#installation)
19
+ 3. Docker https://store.docker.com/search?offering=community&type=edition (optional, but highly recommended)
20
+
21
+ Users with a Docker installation will find the first two requirements met by using the published image layer at https://hub.docker.com/r/jprime/mmonad
22
+
23
+ ## Contributions & Licensing
24
+
25
+ User contributions are welcome and subject to the [CONTRIBUTING](https://github.com/Jared-Prime/mmonad/blob/master/CONTRIBUTING) guide. All code made available under [AGPL-3.0](https://github.com/Jared-Prime/mmonad/blob/master/LICENSE).
26
+
27
+ ## Project Specifications
28
+
29
+ `MMonad` makes two interfaces available to Ruby programmers: (1) the `MMonad::Agent` and (2) the `MMonad::Client`. These interfaces are provided as modules. Users `extend` a class with the chosen interface, supplying specific behaviors via the DSL.
30
+
31
+ DSL for _data-processing_ nodes:
32
+
33
+ - `MMonad::Agent`
34
+ - `.socket` specifies underlying socket or address for networking
35
+ - `.pattern` specifies the 0MQ socket pattern for message delivery
36
+ - `.process` specifies the programmer's steps for message ingestion and/or transformation
37
+ - `.exceptions` specifies the programmer's custom error handling behavior
38
+ - `.run` initiates the data-processing loop with the above DSL specifications, blocking on the thread
39
+
40
+ DSL for _data-passing_ nodes:
41
+
42
+ - `MMonad::Client`
43
+ - `.endpoint` specifies the underlying socket or address for networking
44
+ - `.pattern` specifies the 0MQ socket pattern for message passing
45
+ - `.response` specifies the programmer's steps for response parsing
46
+ - `.timeout` specifies how long to wait on a socket for a response
47
+ - `.message` accepts a Hash to pass along the 0MQ socket as data
48
+
49
+ The structure of the `Mmonad` DSL has been designed such that projects using the `gem` need only focus on their specific business logic, leaving all the generic 0MQ pattern implementation to this project. The examples below demonstrate how projects using `mmonad` focus on their own business logic.
50
+
51
+ ## Examples
52
+
53
+ Each example below has a corresponding feature test. See the feature test directory for basic testing strategies. See the `MMonad::Pattern::LIBRARY` for currently supported patterns.
54
+
55
+ ### Synchronous Request / Reply
56
+
57
+ ```ruby
58
+ class MyAgent
59
+ extend MMonad::Agent
60
+
61
+ socket 'tcp://0.0.0.0:5678'
62
+ pattern :reply
63
+
64
+ process do |message|
65
+ puts "got a message: #{message}"
66
+
67
+ { business_reply: "Business is great!" }
68
+ end
69
+
70
+ exceptions do |exception|
71
+ { business_reply: "This is not good for business: #{exception}" }
72
+ end
73
+ end
74
+
75
+ class MyClient
76
+ extend MMonad::Client
77
+
78
+ endpoint 'tcp://localhost:5678'
79
+ pattern :request
80
+
81
+ timeout 5 # seconds
82
+
83
+ response do |message|
84
+ puts "got a response: #{message}"
85
+ end
86
+ end
87
+
88
+ Thread.new { MyAgent.run }
89
+
90
+ MyClient << { customer_message: "How is business?" }
91
+
92
+ #=> got a message: { "customer_message" => "How is business?" }
93
+ #=> got a response: { "business_reply" => "Business is great!" }
94
+ ```
data/lib/m_monad.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'require_all'
4
-
5
- require_all './lib/m_monad'
6
- require_all './lib/version'
4
+ require_all File.join(File.dirname(__FILE__))
7
5
 
8
6
  module MMonad
9
7
  end
data/lib/version.rb CHANGED
@@ -3,14 +3,14 @@
3
3
  module MMonad
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
- PATCH = 0
7
- RELEASE = 'pre'
6
+ PATCH = 1
7
+ RELEASE = 'p2'
8
8
 
9
9
  VERSION = [
10
10
  MAJOR,
11
11
  MINOR,
12
12
  PATCH,
13
- RELEASE
13
+ RELEASE,
14
14
  ].join('.')
15
15
  .freeze
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmonad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.pre
4
+ version: 0.0.1.p2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Davis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-17 00:00:00.000000000 Z
11
+ date: 2017-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit
@@ -129,6 +129,7 @@ extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
131
  - LICENSE
132
+ - README.md
132
133
  - lib/m_monad.rb
133
134
  - lib/m_monad/agent.rb
134
135
  - lib/m_monad/client.rb
@@ -142,6 +143,7 @@ post_install_message:
142
143
  rdoc_options: []
143
144
  require_paths:
144
145
  - lib
146
+ - lib/m_monad
145
147
  required_ruby_version: !ruby/object:Gem::Requirement
146
148
  requirements:
147
149
  - - ">="