Last active
April 26, 2018 12:46
-
-
Save joshjordan/6415337e8a75fa068bb2923fdb3195e9 to your computer and use it in GitHub Desktop.
Revisions
-
joshjordan revised this gist
Apr 26, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Binary file not shown. -
joshjordan revised this gist
Apr 26, 2018 . 3 changed files with 7 additions and 18 deletions.There are no files selected for viewing
Binary file not shown.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,6 @@ import ( "github.com/jrallison/go-workers" ) func main() { workers.Configure(map[string]string{ "server": "localhost:6379", @@ -21,24 +16,24 @@ func main() { }) fmt.Println("Enqueuing a job...") workers.Enqueue("default", "PrototypeConsumerJob", []string{"Bill", time.Now().String()}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("default", "PrototypeConsumerJob", []string{"Bob", time.Now().String()}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("default", "PrototypeConsumerJob", []string{"Norbert", time.Now().String()}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("default", "PrototypeConsumerJob", []string{"Sherbert", time.Now().String()}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("default", "PrototypeConsumerJob", []string{"Batman", time.Now().String()}) fmt.Println("Waiting for ruby to process jobs...") time.Sleep(10 * time.Minute) } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,9 @@ require 'sidekiq' class PrototypeConsumerJob include Sidekiq::Worker def perform(name, other_arg) puts "Received with string '#{name}' and golang timestamp: #{other_arg}" end end -
joshjordan created this gist
Apr 26, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ golang: go run go-producer.go redis: redis-server ruby: sidekiq -r './ruby-consumer.rb' Binary file not shown.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ package main import ( "fmt" "time" "github.com/jrallison/go-workers" ) //todo: does job name need to match? func PrototypeConsumerJob(message *workers.Msg) {} type myMiddleware struct{} func main() { workers.Configure(map[string]string{ "server": "localhost:6379", "database": "0", "pool": "30", "process": "1", }) fmt.Println("Enqueuing a job...") workers.Enqueue("myqueue3", "Add", []string{"Bill", "Other thing"}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("myqueue3", "Add", []string{"Bob", "Other thing"}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("myqueue3", "Add", []string{"Norbert", "Other thing"}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("myqueue3", "Add", []string{"Sherbert", "Other thing"}) time.Sleep(1000 * time.Millisecond) fmt.Println("Enqueuing a job...") workers.Enqueue("myqueue3", "Add", []string{"Batman", "Other thing"}) fmt.Println("Waiting for ruby to pick them up...") time.Sleep(10 * time.Minute) } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ require 'sidekiq' # Sidekiq.configure_server do |config| # config.redis = { :namespace => 'other-stuff-filewatcher', :size => 1, :url => 'redis://127.0.0.1:6379'} # end class PrototypeConsumerJob include Sidekiq::Worker def perform(name, other_arg) puts "Received job #{name} with arg: #{other_arg}" end end