Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed AM description, added description how to get data back,small …

…modifications
  • Loading branch information...
commit 2fd10fcfd3ee35871fb229e59fb6f6fa9389db2d 1 parent 3bf4b42
@rkononov rkononov authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 README.md
View
14 README.md
@@ -19,9 +19,9 @@ This example show how to work with iron_worker under Rails environment
2. Q: How do you upload workers?
A: You can upload workers in a number of ways:
- * initializer - [iron_worker](https://github.com/iron-io/iron_worker_rails_example/blob/master/config/initializers/iron_worker.rb#L4)
- * rake task (rake iron_worker:upload) - [iron_worker.rake](https://github.com/iron-io/iron_worker_rails_example/blob/master/lib/tasks/iron_worker.rake)
- * controller/model - [controller](https://github.com/iron-io/iron_worker_rails_example/blob/master/app/controllers/codes_controller.rb#L8)
+ * rake task (rake iron_worker:upload) - [iron_worker.rake](https://github.com/iron-io/iron_worker_rails_example/blob/master/lib/tasks/iron_worker.rake) - use this approach when you have deploy script or scenario and you want control when and which workers you want to upload
+ * initializer - [iron_worker](https://github.com/iron-io/iron_worker_rails_example/blob/master/config/initializers/iron_worker.rb#L4) - use this approach when you want to be ensure that all your workers always are up to date (but don't forget that workers will be uploaded every time you restart rails)
+ * controller/model - [controller](https://github.com/iron-io/iron_worker_rails_example/blob/master/app/controllers/codes_controller.rb#L8) - we don't recommend to upload workers from controllers or models, but with this approach you could upload/modify workers without touching rails
3. Q: How do you use ActionMailer within a worker?
@@ -30,6 +30,7 @@ This example show how to work with iron_worker under Rails environment
* send connection details as parameter [mailer details](https://github.com/iron-io/iron_worker_rails_example/blob/master/app/controllers/custom_examples_controller.rb#L6)
* configure mailer in worker - [init_mailer](https://github.com/iron-io/iron_worker_rails_example/blob/master/workers/simple_mailer_worker.rb#L7)
* [send email](https://github.com/iron-io/iron_worker_rails_example/blob/master/workers/simple_mailer_worker.rb#L29)
+Important note, if you're passing ActionMailer config hash as worker params you need to convert them on worker side to 'valid' hash([example](https://github.com/iron-io/iron_worker_rails_example/blob/master/workers/simple_mailer_worker.rb#L9)).
4. Q: How do you use Models and/or connect to a database within a worker?
@@ -38,3 +39,10 @@ This example show how to work with iron_worker under Rails environment
* send connection details as parameter [database details](https://github.com/iron-io/iron_worker_rails_example/blob/master/app/controllers/custom_examples_controller.rb#L6)
* configure database connection in worker - [setup_database](https://github.com/iron-io/iron_worker_rails_example/blob/master/workers/simple_mailer_worker.rb#L16)
* [use model](https://github.com/iron-io/iron_worker_rails_example/blob/master/workers/simple_mailer_worker.rb#L29)
+
+5. Q: How to get processed data back from worker?
+
+ A: There are few ways:
+ * Write processed data directly to db (need to configure connection and use models)
+ * Store data in external persister like IronCache (look at [DeserializeWorker](https://github.com/iron-io/iron_worker_rails_example/blob/master/workers/deserialize_worker.rb))
+ * Send/Recieve data via IronMQ (look at [WebCrawler](https://github.com/iron-io/iron_worker_examples/tree/master/ruby_ng/web_crawler_nokogiri) example)
Please sign in to comment.
Something went wrong with that request. Please try again.