-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #507 from pocke/follow-494
Follow 494
- Loading branch information
Showing
9 changed files
with
188 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
additional_gems: | ||
- aws-sdk-sqs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Shoryuken | ||
class Client | ||
def self.queues: (String name) -> Queue | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Shoryuken | ||
module Logging | ||
def self.initialize_logger: (?Logger::logdev? log_target) -> Logger | ||
|
||
def self.logger: () -> Logger | ||
|
||
def self.logger=: (Logger log) -> void | ||
|
||
def self.with_context: (untyped msg) { () -> void } -> void | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dependencies: | ||
- name: forwardable | ||
- name: logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module Shoryuken | ||
module Middleware | ||
class Chain | ||
attr_reader entries: Array[Entry] | ||
|
||
def add: (singleton(Class) klass, *untyped args) -> void | ||
|
||
def clear: () -> void | ||
|
||
def exists?: (untyped klass) -> bool | ||
|
||
def insert_after: (untyped oldklass, untyped newklass, *untyped args) -> void | ||
|
||
def insert_before: (untyped oldklass, untyped newklass, *untyped args) -> void | ||
|
||
def invoke: (*untyped args) { () -> void } -> void | ||
|
||
def prepend: (untyped klass, *untyped args) -> void | ||
|
||
def remove: (untyped klass) -> void | ||
|
||
def retrieve: () -> Array[untyped] | ||
|
||
private | ||
|
||
def initialize: () ?{ (self) -> void } -> void | ||
|
||
class Entry | ||
attr_reader klass: singleton(Class) | ||
|
||
@args: Array[untyped] | ||
|
||
def initialize: (singleton(Class), *untyped args) -> void | ||
|
||
def make_new: () -> untyped | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module Shoryuken | ||
class Options | ||
type group = { concurrency: Integer, delay: Numeric, queues: Array[String] } | ||
|
||
attr_accessor active_job_queue_name_prefixing: bool | ||
attr_accessor cache_visibility_timeout: bool | ||
attr_accessor groups: Hash[String, group] | ||
attr_accessor exception_handlers: Array[untyped] | ||
attr_accessor launcher_executor: untyped | ||
attr_accessor worker_executor: untyped | ||
attr_accessor worker_registry: untyped | ||
attr_accessor start_callback: (^() -> void | nil) | ||
attr_accessor stop_callback: (^() -> void | nil) | ||
attr_writer default_worker_options: Hash[String, untyped] | ||
attr_writer sqs_client: Aws::SQS::Client | ||
attr_reader sqs_client_receive_message_opts: Hash[Symbol, untyped] | ||
|
||
def active_job?: () -> boolish | ||
|
||
def active_job_queue_name_prefixing?: () -> bool | ||
|
||
def add_group: (String group, ?Integer concurrency, ?delay: Numeric) -> void | ||
|
||
def add_queue: (String queue, Integer weight, String group) -> void | ||
|
||
def cache_visibility_timeout?: () -> bool | ||
|
||
def client_middleware: () ?{ (Middleware::Chain) -> void } -> Middleware::Chain | ||
|
||
def configure_client: () { (self) -> void } -> void | ||
|
||
def configure_server: () { (self) -> void } -> void | ||
|
||
def delay: (String group) -> Numeric | ||
|
||
def logger: () -> Logger | ||
|
||
def on: (Symbol event) { () -> void } -> void | ||
|
||
def on_start: () { () -> void } -> void | ||
|
||
def on_stop: () { () -> void } -> void | ||
|
||
def options: () -> Hash[Symbol, untyped] | ||
|
||
def polling_strategy: (String group) -> untyped | ||
|
||
def register_worker: (*untyped args) -> void | ||
|
||
def server?: () -> bool | ||
|
||
def server_middleware: () ?{ (Middleware::Chain) -> void } -> Middleware::Chain | ||
|
||
def sqs_client: () -> Aws::SQS::Client | ||
|
||
def ungrouped_queues: () -> Array[untyped] | ||
|
||
private | ||
|
||
def default_client_middleware: () -> Middleware::Chain | ||
|
||
def default_server_middleware: () -> Middleware::Chain | ||
|
||
def initialize: () -> void | ||
|
||
DEFAULTS: ::Hash[Symbol, untyped] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Shoryuken | ||
class Queue | ||
def visibility_timeout: () -> Integer | ||
def delete_messages: (untyped options) -> void | ||
def send_message: (untyped options) -> void | ||
def send_messages: (untyped options) -> void | ||
def receive_messages: (untyped options) -> void | ||
def fifo?: () -> bool | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,47 @@ | ||
module Shoryuken | ||
class Client | ||
def self.queues: (String name) -> Queue | ||
end | ||
|
||
class Queue | ||
def visibility_timeout: () -> Integer | ||
def delete_messages: (untyped options) -> void | ||
def send_message: (untyped options) -> void | ||
def send_messages: (untyped options) -> void | ||
def receive_messages: (untyped options) -> void | ||
def fifo?: () -> bool | ||
end | ||
|
||
module Worker | ||
module ClassMethods | ||
def shoryuken_options: (?queue: String, ?delete: bool, ?auto_delete: bool, ?auto_visibility_timeout: bool, ?retry_intervals: Numeric, ?batch: bool) -> void | ||
end | ||
end | ||
|
||
def self.logger: () -> Logger | ||
extend SingleForwardable | ||
|
||
def self?.shoryuken_options: () -> Options | ||
|
||
def self?.healthy?: () -> bool | ||
|
||
# would be great here to somehow annotate delegation... | ||
|
||
def self?.active_job?: () -> boolish | ||
|
||
def self?.add_group: (String group, ?Integer concurrency, ?delay: Numeric) -> void | ||
|
||
def self?.add_queue: (String queue, Integer weight, String group) -> void | ||
|
||
def self?.ungrouped_queues: () -> Array[untyped] | ||
|
||
def self?.active_job_queue_name_prefixing?: () -> bool | ||
|
||
def self?.sqs_client: () -> Aws::SQS::Client | ||
|
||
def self?.options: () -> Hash[Symbol, untyped] | ||
|
||
def self?.logger: () -> Logger | ||
|
||
def self?.register_worker: (*untyped args) -> void | ||
|
||
def self?.configure_server: () { (self) -> void } -> void | ||
|
||
def self?.server?: () -> bool | ||
|
||
def self?.server_middleware: () ?{ (Middleware::Chain) -> void } -> Middleware::Chain | ||
|
||
def self?.configure_client: () { (self) -> void } -> void | ||
|
||
def self?.client_middleware: () ?{ (Middleware::Chain) -> void } -> Middleware::Chain | ||
|
||
def self?.on: (Symbol event) { () -> void } -> void | ||
|
||
def self?.on_start: () { () -> void } -> void | ||
|
||
def self?.on_stop: () { () -> void } -> void | ||
|
||
def self?.delay: (String group) -> Numeric | ||
|
||
VERSION: ::String | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Shoryuken | ||
module Worker | ||
module ClassMethods | ||
def shoryuken_options: (?queue: String, ?delete: bool, ?auto_delete: bool, ?auto_visibility_timeout: bool, ?retry_intervals: Numeric, ?batch: bool) -> void | ||
end | ||
end | ||
end |