Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
c8153fcf
Commit
c8153fcf
authored
Mar 16, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more modularization on agent framework
parent
c546fc73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
16 deletions
+24
-16
config.ru
config.ru
+1
-1
agent.rb
lib/noah/agent.rb
+0
-3
base_agent.rb
lib/noah/agents/base_agent.rb
+17
-0
dummy_agent.rb
lib/noah/agents/dummy_agent.rb
+4
-6
http_agent.rb
lib/noah/agents/http_agent.rb
+2
-6
No files found.
config.ru
View file @
c8153fcf
require
'rubygems'
require
'rubygems'
require
File
.
join
(
'.'
,
'lib'
,
'noah'
)
require
File
.
join
(
'.'
,
'lib'
,
'noah'
)
## Uncomment the following to hardcode a redis url
## Uncomment the following to hardcode a redis url
ENV
[
'REDIS_URL'
]
=
"redis://localhost:6379/
1
"
ENV
[
'REDIS_URL'
]
=
"redis://localhost:6379/
0
"
noah
=
Noah
::
App
.
new
noah
=
Noah
::
App
.
new
run
noah
run
noah
lib/noah/agent.rb
View file @
c8153fcf
...
@@ -9,9 +9,6 @@ module Noah
...
@@ -9,9 +9,6 @@ module Noah
class
Agent
class
Agent
include
EM
::
Deferrable
include
EM
::
Deferrable
Noah
::
Agents
::
HttpAgent
.
register
Noah
::
Agents
::
DummyAgent
.
register
@@watchers
=
Noah
::
Watcher
.
watch_list
@@watchers
=
Noah
::
Watcher
.
watch_list
@@agents
=
Noah
::
Watchers
.
agents
@@agents
=
Noah
::
Watchers
.
agents
...
...
lib/noah/agents/base_agent.rb
0 → 100644
View file @
c8153fcf
require
'logger'
require
'logger'
module
Noah::Agents
module
Base
class
<<
self
include
EM
::
Deferrable
PREFIX
=
"base"
NAME
=
"base-agent"
end
def
self
.
included
(
base
)
Noah
::
Watchers
.
register_agent
(
base
)
end
end
end
lib/noah/agents/dummy_agent.rb
View file @
c8153fcf
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'base_agent'
)
module
Noah::Agents
module
Noah::Agents
class
DummyAgent
class
DummyAgent
include
EM
::
Deferrabl
e
include
Noah
::
Agents
::
Bas
e
PREFIX
=
"dummy"
PREFIX
=
"dummy"
NAME
=
"dummy"
NAME
=
"dummy"
def
self
.
register
Noah
::
Watchers
.
register_agent
(
self
)
end
def
self
.
notify
(
event
,
message
,
watch_list
)
def
self
.
notify
(
event
,
message
,
watch_list
)
logger
=
LOGGER
logger
=
LOGGER
logger
.
info
(
"
#{
NAME
}
: Worker initiated"
)
logger
.
info
(
"
#{
NAME
}
: Worker initiated"
)
...
@@ -21,8 +19,8 @@ module Noah::Agents
...
@@ -21,8 +19,8 @@ module Noah::Agents
logger
.
info
(
"
#{
NAME
}
: Sending message to:
#{
ep
}
for pattern:
#{
p
}
"
)
logger
.
info
(
"
#{
NAME
}
: Sending message to:
#{
ep
}
for pattern:
#{
p
}
"
)
logger
.
debug
(
"
#{
NAME
}
: message received:
#{
message
}
"
)
logger
.
debug
(
"
#{
NAME
}
: message received:
#{
message
}
"
)
end
end
iter
.
next
end
end
iter
.
next
end
end
end
end
...
...
lib/noah/agents/http_agent.rb
View file @
c8153fcf
require
'logger'
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'base_agent'
)
module
Noah::Agents
module
Noah::Agents
class
HttpAgent
class
HttpAgent
include
EM
::
Deferrabl
e
include
Noah
::
Agents
::
Bas
e
PREFIX
=
"http"
PREFIX
=
"http"
NAME
=
"http"
NAME
=
"http"
def
self
.
register
Noah
::
Watchers
.
register_agent
(
self
)
end
def
self
.
notify
(
event
,
message
,
watch_list
)
def
self
.
notify
(
event
,
message
,
watch_list
)
logger
=
LOGGER
logger
=
LOGGER
logger
.
info
(
"
#{
NAME
}
: Worker initiated"
)
logger
.
info
(
"
#{
NAME
}
: Worker initiated"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment