rhoconnect 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +208 -0
- data/CREDITS +38 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +97 -0
- data/LICENSE +75 -0
- data/README.md +10 -0
- data/Rakefile +82 -0
- data/bench/bench +7 -0
- data/bench/bench_runner.rb +112 -0
- data/bench/benchapp/Gemfile +21 -0
- data/bench/benchapp/Gemfile.lock +76 -0
- data/bench/benchapp/Rakefile +22 -0
- data/bench/benchapp/application.rb +39 -0
- data/bench/benchapp/config.ru +36 -0
- data/bench/benchapp/settings/license.key +1 -0
- data/bench/benchapp/settings/settings.yml +20 -0
- data/bench/benchapp/sources/mock_adapter.rb +55 -0
- data/bench/benchapp/sources/queue_mock_adapter.rb +2 -0
- data/bench/benchapp/spec/sources/mock_adapter_spec.rb +25 -0
- data/bench/benchapp/spec/sources/queue_mock_adapter_spec.rb +25 -0
- data/bench/benchapp/spec/spec_helper.rb +42 -0
- data/bench/blobapp/Gemfile +31 -0
- data/bench/blobapp/Gemfile.lock +103 -0
- data/bench/blobapp/Rakefile +25 -0
- data/bench/blobapp/application.rb +44 -0
- data/bench/blobapp/config.ru +36 -0
- data/bench/blobapp/settings/license.key +1 -0
- data/bench/blobapp/settings/settings.yml +16 -0
- data/bench/blobapp/sources/blob_adapter.rb +71 -0
- data/bench/blobapp/spec/sources/blob_adapter_spec.rb +25 -0
- data/bench/blobapp/spec/spec_helper.rb +42 -0
- data/bench/lib/bench/cli.rb +16 -0
- data/bench/lib/bench/logging.rb +13 -0
- data/bench/lib/bench/mock_client.rb +41 -0
- data/bench/lib/bench/result.rb +50 -0
- data/bench/lib/bench/runner.rb +107 -0
- data/bench/lib/bench/session.rb +67 -0
- data/bench/lib/bench/statistics.rb +56 -0
- data/bench/lib/bench/test_data.rb +98 -0
- data/bench/lib/bench/timer.rb +10 -0
- data/bench/lib/bench/utils.rb +49 -0
- data/bench/lib/bench.rb +129 -0
- data/bench/lib/testdata/100-data.txt +148 -0
- data/bench/lib/testdata/5-data.txt +9 -0
- data/bench/lib/testdata/images/icon.ico +0 -0
- data/bench/lib/testdata/images/icon.png +0 -0
- data/bench/lib/testdata/images/loading-Landscape.png +0 -0
- data/bench/lib/testdata/images/loading-LandscapeLeft.png +0 -0
- data/bench/lib/testdata/images/loading-LandscapeRight.png +0 -0
- data/bench/lib/testdata/images/loading-Portrait.png +0 -0
- data/bench/lib/testdata/images/loading-PortraitUpsideDown.png +0 -0
- data/bench/lib/testdata/images/loading.png +0 -0
- data/bench/lib/testdata/images/loading@2x.png +0 -0
- data/bench/run_bench.sh +42 -0
- data/bench/run_blob_script.sh +3 -0
- data/bench/run_cud_script.sh +3 -0
- data/bench/run_query_md_script.sh +3 -0
- data/bench/run_query_only_script.sh +3 -0
- data/bench/run_query_script.sh +3 -0
- data/bench/scripts/blob_cud_script.rb +98 -0
- data/bench/scripts/cud_script.rb +92 -0
- data/bench/scripts/helpers.rb +101 -0
- data/bench/scripts/query_md_script.rb +45 -0
- data/bench/scripts/query_only_script.rb +51 -0
- data/bench/scripts/query_script.rb +45 -0
- data/bench/spec/bench_spec_helper.rb +33 -0
- data/bench/spec/logging_spec.rb +15 -0
- data/bench/spec/mock_adapter_spec.rb +61 -0
- data/bench/spec/mock_client_spec.rb +65 -0
- data/bench/spec/result_spec.rb +61 -0
- data/bench/spec/utils_spec.rb +36 -0
- data/bin/rhoconnect +34 -0
- data/bin/rhoconnect-setup +84 -0
- data/doc/async-jobs.txt +69 -0
- data/doc/authentication.txt +76 -0
- data/doc/benchmarks.txt +168 -0
- data/doc/blob-sync.txt +130 -0
- data/doc/bulk-sync.txt +102 -0
- data/doc/client.txt +432 -0
- data/doc/command-line.txt +210 -0
- data/doc/contributing.txt +60 -0
- data/doc/deploying.txt +82 -0
- data/doc/install.txt +28 -0
- data/doc/introduction.txt +20 -0
- data/doc/licensing.txt +18 -0
- data/doc/metadata.txt +458 -0
- data/doc/migration.txt +182 -0
- data/doc/public/css/print.css +29 -0
- data/doc/public/css/screen.css +257 -0
- data/doc/public/css/style.css +20 -0
- data/doc/push.txt +135 -0
- data/doc/release.txt +41 -0
- data/doc/rest-api.txt +367 -0
- data/doc/source-adapters.txt +325 -0
- data/doc/stats-middleware.txt +69 -0
- data/doc/testing.txt +222 -0
- data/doc/tutorial.txt +315 -0
- data/doc/web-console.txt +35 -0
- data/examples/simple/Rakefile +14 -0
- data/examples/simple/application.rb +27 -0
- data/examples/simple/config.ru +49 -0
- data/examples/simple/settings/license.key +1 -0
- data/examples/simple/settings/settings.yml +23 -0
- data/examples/simple/sources/sample_adapter.rb +5 -0
- data/examples/simple/sources/simple_adapter.rb +5 -0
- data/generators/rhoconnect.rb +119 -0
- data/generators/templates/application/Gemfile +21 -0
- data/generators/templates/application/Rakefile +22 -0
- data/generators/templates/application/application.rb +39 -0
- data/generators/templates/application/config.ru +36 -0
- data/generators/templates/application/settings/license.key +1 -0
- data/generators/templates/application/settings/settings.yml +14 -0
- data/generators/templates/application/spec/spec_helper.rb +42 -0
- data/generators/templates/source/source_adapter.rb +47 -0
- data/generators/templates/source/source_spec.rb +25 -0
- data/install.sh +408 -0
- data/installer/unix-like/rho_connect_install_checkers.rb +140 -0
- data/installer/unix-like/rho_connect_install_constants.rb +51 -0
- data/installer/unix-like/rho_connect_install_debian.rb +63 -0
- data/installer/unix-like/rho_connect_install_dnd.rb +58 -0
- data/installer/unix-like/rho_connect_install_get_params.rb +30 -0
- data/installer/unix-like/rho_connect_install_installers.rb +142 -0
- data/installer/unix-like/rho_connect_install_utilities.rb +85 -0
- data/installer/unix-like/rho_connect_install_yum.rb +63 -0
- data/installer/unix-like/rhoinstaller.rb +89 -0
- data/installer/utils/create_texts.rb +366 -0
- data/installer/utils/install_test.rb +140 -0
- data/installer/windows/EnvVarUpdate.nsh +328 -0
- data/installer/windows/ServiceLib.nsh +369 -0
- data/installer/windows/configUi.ini +44 -0
- data/installer/windows/icon.ico +0 -0
- data/installer/windows/rhosync.nsi +418 -0
- data/installer/windows/uninstall.bat +7 -0
- data/lib/rhoconnect/api/admin/get_api_token.rb +14 -0
- data/lib/rhoconnect/api/admin/get_license_info.rb +8 -0
- data/lib/rhoconnect/api/admin/login.rb +6 -0
- data/lib/rhoconnect/api/admin/reset.rb +10 -0
- data/lib/rhoconnect/api/admin/stats.rb +21 -0
- data/lib/rhoconnect/api/application/bulk_data.rb +7 -0
- data/lib/rhoconnect/api/application/clientcreate.rb +8 -0
- data/lib/rhoconnect/api/application/clientlogin.rb +6 -0
- data/lib/rhoconnect/api/application/clientregister.rb +6 -0
- data/lib/rhoconnect/api/application/clientreset.rb +6 -0
- data/lib/rhoconnect/api/application/query.rb +7 -0
- data/lib/rhoconnect/api/application/queue_updates.rb +6 -0
- data/lib/rhoconnect/api/application/search.rb +6 -0
- data/lib/rhoconnect/api/client/create_client.rb +3 -0
- data/lib/rhoconnect/api/client/delete_client.rb +5 -0
- data/lib/rhoconnect/api/client/get_client_params.rb +3 -0
- data/lib/rhoconnect/api/client/list_client_docs.rb +12 -0
- data/lib/rhoconnect/api/client/list_clients.rb +3 -0
- data/lib/rhoconnect/api/client/ping.rb +7 -0
- data/lib/rhoconnect/api/source/get_adapter.rb +3 -0
- data/lib/rhoconnect/api/source/get_db_doc.rb +7 -0
- data/lib/rhoconnect/api/source/get_source_params.rb +3 -0
- data/lib/rhoconnect/api/source/list_source_docs.rb +10 -0
- data/lib/rhoconnect/api/source/list_sources.rb +15 -0
- data/lib/rhoconnect/api/source/push_deletes.rb +8 -0
- data/lib/rhoconnect/api/source/push_objects.rb +8 -0
- data/lib/rhoconnect/api/source/save_adapter.rb +3 -0
- data/lib/rhoconnect/api/source/set_db_doc.rb +8 -0
- data/lib/rhoconnect/api/source/set_refresh_time.rb +8 -0
- data/lib/rhoconnect/api/source/upload_file.rb +4 -0
- data/lib/rhoconnect/api/user/create_user.rb +7 -0
- data/lib/rhoconnect/api/user/delete_user.rb +9 -0
- data/lib/rhoconnect/api/user/list_users.rb +3 -0
- data/lib/rhoconnect/api/user/update_user.rb +4 -0
- data/lib/rhoconnect/api_token.rb +19 -0
- data/lib/rhoconnect/app.rb +76 -0
- data/lib/rhoconnect/bulk_data/bulk_data.rb +88 -0
- data/lib/rhoconnect/bulk_data/syncdb.index.schema +4 -0
- data/lib/rhoconnect/bulk_data/syncdb.schema +41 -0
- data/lib/rhoconnect/bulk_data.rb +2 -0
- data/lib/rhoconnect/client.rb +96 -0
- data/lib/rhoconnect/client_sync.rb +412 -0
- data/lib/rhoconnect/console/app/helpers/auth_helper.rb +22 -0
- data/lib/rhoconnect/console/app/helpers/extensions.rb +19 -0
- data/lib/rhoconnect/console/app/helpers/helpers.rb +57 -0
- data/lib/rhoconnect/console/app/public/ThickBox.css +649 -0
- data/lib/rhoconnect/console/app/public/home.css +438 -0
- data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
- data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/rhomobile_rhohub_logo.png +0 -0
- data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
- data/lib/rhoconnect/console/app/public/jqplot/excanvas.min.js +35 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.barRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisLabelRenderer.js +187 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisTickRenderer.js +226 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasTextRenderer.js +408 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.categoryAxisRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.cursor.js +952 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.js +313 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.pointLabels.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery-1.4.2.min.js +154 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.css +1 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.js +34 -0
- data/lib/rhoconnect/console/app/public/main.css +7 -0
- data/lib/rhoconnect/console/app/public/reset.css +76 -0
- data/lib/rhoconnect/console/app/public/style.css +2201 -0
- data/lib/rhoconnect/console/app/public/text.txt +0 -0
- data/lib/rhoconnect/console/app/routes/adapter.rb +28 -0
- data/lib/rhoconnect/console/app/routes/auth.rb +29 -0
- data/lib/rhoconnect/console/app/routes/client.rb +31 -0
- data/lib/rhoconnect/console/app/routes/docs.rb +145 -0
- data/lib/rhoconnect/console/app/routes/heroku.rb +19 -0
- data/lib/rhoconnect/console/app/routes/home.rb +63 -0
- data/lib/rhoconnect/console/app/routes/timing.rb +242 -0
- data/lib/rhoconnect/console/app/routes/user.rb +117 -0
- data/lib/rhoconnect/console/app/views/adapter.erb +16 -0
- data/lib/rhoconnect/console/app/views/client.erb +30 -0
- data/lib/rhoconnect/console/app/views/content.erb +14 -0
- data/lib/rhoconnect/console/app/views/doc.erb +8 -0
- data/lib/rhoconnect/console/app/views/docdata.erb +28 -0
- data/lib/rhoconnect/console/app/views/docs.erb +30 -0
- data/lib/rhoconnect/console/app/views/edituser.erb +13 -0
- data/lib/rhoconnect/console/app/views/headermenu.erb +40 -0
- data/lib/rhoconnect/console/app/views/home.erb +24 -0
- data/lib/rhoconnect/console/app/views/index.erb +58 -0
- data/lib/rhoconnect/console/app/views/jqplot.erb +52 -0
- data/lib/rhoconnect/console/app/views/layout.erb +165 -0
- data/lib/rhoconnect/console/app/views/login.erb +26 -0
- data/lib/rhoconnect/console/app/views/newuser.erb +17 -0
- data/lib/rhoconnect/console/app/views/ping.erb +28 -0
- data/lib/rhoconnect/console/app/views/result.erb +11 -0
- data/lib/rhoconnect/console/app/views/rightboxlinks.erb +15 -0
- data/lib/rhoconnect/console/app/views/select_doc.erb +17 -0
- data/lib/rhoconnect/console/app/views/upload_doc.erb +23 -0
- data/lib/rhoconnect/console/app/views/user.erb +29 -0
- data/lib/rhoconnect/console/app/views/users.erb +12 -0
- data/lib/rhoconnect/console/rhoconnect_api.rb +245 -0
- data/lib/rhoconnect/console/server.rb +32 -0
- data/lib/rhoconnect/console.rb +3 -0
- data/lib/rhoconnect/cors.rb +229 -0
- data/lib/rhoconnect/credential.rb +9 -0
- data/lib/rhoconnect/db_adapter.rb +46 -0
- data/lib/rhoconnect/document.rb +49 -0
- data/lib/rhoconnect/dynamic_adapter.rb +91 -0
- data/lib/rhoconnect/generator.rb +1 -0
- data/lib/rhoconnect/jobs/bulk_data_job.rb +203 -0
- data/lib/rhoconnect/jobs/ping_job.rb +46 -0
- data/lib/rhoconnect/jobs/source_job.rb +16 -0
- data/lib/rhoconnect/license.rb +86 -0
- data/lib/rhoconnect/lock_ops.rb +11 -0
- data/lib/rhoconnect/model.rb +414 -0
- data/lib/rhoconnect/ping/android.rb +56 -0
- data/lib/rhoconnect/ping/apple.rb +52 -0
- data/lib/rhoconnect/ping/blackberry.rb +56 -0
- data/lib/rhoconnect/ping.rb +3 -0
- data/lib/rhoconnect/read_state.rb +31 -0
- data/lib/rhoconnect/rho_indifferent_access.rb +88 -0
- data/lib/rhoconnect/server/views/index.erb +13 -0
- data/lib/rhoconnect/server.rb +286 -0
- data/lib/rhoconnect/source.rb +289 -0
- data/lib/rhoconnect/source_adapter.rb +123 -0
- data/lib/rhoconnect/source_sync.rb +302 -0
- data/lib/rhoconnect/stats/middleware.rb +20 -0
- data/lib/rhoconnect/stats/record.rb +108 -0
- data/lib/rhoconnect/store.rb +232 -0
- data/lib/rhoconnect/tasks.rb +350 -0
- data/lib/rhoconnect/test_methods.rb +220 -0
- data/lib/rhoconnect/user.rb +95 -0
- data/lib/rhoconnect/version.rb +3 -0
- data/lib/rhoconnect/x_domain_session_wrapper.rb +53 -0
- data/lib/rhoconnect.rb +285 -0
- data/rhoconnect.gemspec +67 -0
- data/spec/api/admin/api_token_spec.rb +14 -0
- data/spec/api/admin/get_api_token_spec.rb +36 -0
- data/spec/api/admin/get_license_info_spec.rb +38 -0
- data/spec/api/admin/reset_spec.rb +22 -0
- data/spec/api/admin/stats_spec.rb +66 -0
- data/spec/api/api_helper.rb +21 -0
- data/spec/api/application/rhoconnect_api_spec.rb +548 -0
- data/spec/api/client/create_client_spec.rb +13 -0
- data/spec/api/client/delete_client_spec.rb +13 -0
- data/spec/api/client/get_client_params_spec.rb +18 -0
- data/spec/api/client/list_client_docs_spec.rb +32 -0
- data/spec/api/client/list_clients_spec.rb +22 -0
- data/spec/api/client/ping_spec.rb +23 -0
- data/spec/api/rhosync_api_spec.rb.orig +606 -0
- data/spec/api/source/adapter_spec.rb +29 -0
- data/spec/api/source/get_db_doc_spec.rb +21 -0
- data/spec/api/source/get_source_params_spec.rb +32 -0
- data/spec/api/source/list_source_docs_spec.rb +25 -0
- data/spec/api/source/list_sources_spec.rb +26 -0
- data/spec/api/source/push_deletes_spec.rb +18 -0
- data/spec/api/source/push_objects_spec.rb +27 -0
- data/spec/api/source/set_db_doc_spec.rb +19 -0
- data/spec/api/source/set_refresh_time_spec.rb +43 -0
- data/spec/api/source/upload_file_spec.rb +26 -0
- data/spec/api/user/create_user_spec.rb +16 -0
- data/spec/api/user/delete_user_spec.rb +36 -0
- data/spec/api/user/list_users_spec.rb +30 -0
- data/spec/api/user/update_user_spec.rb +31 -0
- data/spec/api_token_spec.rb +14 -0
- data/spec/app_spec.rb +18 -0
- data/spec/apps/emptyapp/application.rb +27 -0
- data/spec/apps/emptyapp/settings/license.key +1 -0
- data/spec/apps/emptyapp/settings/settings.yml +14 -0
- data/spec/apps/rhotestapp/Rakefile +1 -0
- data/spec/apps/rhotestapp/application.rb +19 -0
- data/spec/apps/rhotestapp/config.ru +1 -0
- data/spec/apps/rhotestapp/settings/apple_fake_cert.pem +1 -0
- data/spec/apps/rhotestapp/settings/license.key +1 -0
- data/spec/apps/rhotestapp/settings/settings.yml +36 -0
- data/spec/apps/rhotestapp/sources/base_adapter.rb +9 -0
- data/spec/apps/rhotestapp/sources/fixed_schema_adapter.rb +28 -0
- data/spec/apps/rhotestapp/sources/sample_adapter.rb +71 -0
- data/spec/apps/rhotestapp/sources/simple_adapter.rb +41 -0
- data/spec/apps/rhotestapp/sources/sub_adapter.rb +7 -0
- data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb +8 -0
- data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb +1 -0
- data/spec/bulk_data/bulk_data_spec.rb +97 -0
- data/spec/client_spec.rb +124 -0
- data/spec/client_sync_spec.rb +774 -0
- data/spec/doc/base.html +72 -0
- data/spec/doc/doc_spec.rb +376 -0
- data/spec/doc/footer.html +4 -0
- data/spec/doc/header.html +30 -0
- data/spec/document_spec.rb +31 -0
- data/spec/dynamic_adapter_spec.rb +43 -0
- data/spec/factories/factories.rb +17 -0
- data/spec/generator/generator_spec.rb +58 -0
- data/spec/generator/generator_spec_helper.rb +9 -0
- data/spec/jobs/bulk_data_job_spec.rb +125 -0
- data/spec/jobs/ping_job_spec.rb +102 -0
- data/spec/jobs/source_job_spec.rb +29 -0
- data/spec/license_spec.rb +66 -0
- data/spec/model_spec.rb +273 -0
- data/spec/perf/bulk_data_perf_spec.rb +32 -0
- data/spec/perf/perf_spec_helper.rb +50 -0
- data/spec/perf/store_perf_spec.rb +27 -0
- data/spec/ping/android_spec.rb +91 -0
- data/spec/ping/apple_spec.rb +70 -0
- data/spec/ping/blackberry_spec.rb +62 -0
- data/spec/read_state_spec.rb +35 -0
- data/spec/rhosync_spec.rb +75 -0
- data/spec/server/cors_spec.rb +287 -0
- data/spec/server/server_spec.rb +470 -0
- data/spec/server/x_domain_session_wrapper_spec.rb +150 -0
- data/spec/source_adapter_spec.rb +125 -0
- data/spec/source_spec.rb +114 -0
- data/spec/source_sync_spec.rb +328 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +231 -0
- data/spec/stats/middleware_spec.rb +53 -0
- data/spec/stats/record_spec.rb +92 -0
- data/spec/store_spec.rb +251 -0
- data/spec/support/shared_examples.rb +168 -0
- data/spec/sync_states_spec.rb +72 -0
- data/spec/test_methods_spec.rb +134 -0
- data/spec/testdata/1000-data.txt +1414 -0
- data/spec/testdata/compressed/compress-data.txt +1 -0
- data/spec/testdata/upload1.txt +1 -0
- data/spec/testdata/upload2.txt +1 -0
- data/spec/user_spec.rb +139 -0
- data/tasks/redis.rake +206 -0
- metadata +706 -0
data/doc/async-jobs.txt
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
Adapter Jobs with Resque
|
2
|
+
===
|
3
|
+
|
4
|
+
RhoConnect uses the [resque](http://github.com/defunkt/resque) library for managing and executing asynchronous jobs. Using async jobs are especially useful when your application requires processing large amounts of data, pinging devices using the built-in push support, or you just want to perform some task that will take a long period of time.
|
5
|
+
|
6
|
+
## Async Job Types
|
7
|
+
RhoConnect supports three job types: BulkDataJob, PingJob, SourceJob
|
8
|
+
|
9
|
+
### BulkDataJob
|
10
|
+
[Bulk Data](/rhoconnect/bulk-sync) jobs are used by RhoConnect to prepare the [bulk sync data files](/rhoconnect/bulk-sync#data-files). These jobs are automatically queued by the RhoConnect application, so it is not necessary to queue them manually.
|
11
|
+
|
12
|
+
### PingJob
|
13
|
+
Ping jobs are used to execute a [device ping](/rhoconnect/push). A PingJob can be queued from anywhere in your RhoConnect application (i.e. at the end of another job or adapter query method).
|
14
|
+
|
15
|
+
Example:
|
16
|
+
|
17
|
+
:::ruby
|
18
|
+
Resque.enqueue(
|
19
|
+
PingJob,
|
20
|
+
{
|
21
|
+
"user_id" => current_user.login,
|
22
|
+
"message" => "New products available!",
|
23
|
+
"badge" => 1,
|
24
|
+
"sources" => ['Product']
|
25
|
+
}
|
26
|
+
)
|
27
|
+
|
28
|
+
### SourceJob
|
29
|
+
Source jobs are used to execute source adapter queues asynchronously.
|
30
|
+
|
31
|
+
To make your source adapters always run asynchronously, define a queue in `settings/settings.yml`:
|
32
|
+
|
33
|
+
:::yaml
|
34
|
+
Product:
|
35
|
+
:queue: product
|
36
|
+
|
37
|
+
Then run a resque worker so the job will execute.
|
38
|
+
|
39
|
+
Example that queues a new source adapter job manually:
|
40
|
+
|
41
|
+
:::ruby
|
42
|
+
Resque.enqueue(
|
43
|
+
SourceJob,
|
44
|
+
:query,
|
45
|
+
APP_NAME,
|
46
|
+
'Joe',
|
47
|
+
'some-client-id
|
48
|
+
)
|
49
|
+
|
50
|
+
## Running Async Jobs
|
51
|
+
Running RhoConnect jobs requires one or more [resque](http://github.com/defunkt/resque) workers running. For example, to start one resque worker listening for all job queues:
|
52
|
+
|
53
|
+
:::term
|
54
|
+
$ cd <your rhoconnect app>
|
55
|
+
$ QUEUE=* rake resque:work
|
56
|
+
|
57
|
+
To start multiple workers(in this case 5):
|
58
|
+
|
59
|
+
:::term
|
60
|
+
$ cd <your rhoconnect app>
|
61
|
+
$ QUEUE=* COUNT=5 rake resque:workers
|
62
|
+
|
63
|
+
For more information on the options available when running resque workers, please refer to the [resque readme](https://github.com/defunkt/resque#readme).
|
64
|
+
|
65
|
+
If you want to run resque workers in daemon mode, we recommend using [nohup](http://en.wikipedia.org/wiki/Nohup), [god](http://github.com/defunkt/resque/tree/master/examples/god/), or [monit](http://github.com/defunkt/resque/tree/master/examples/monit):
|
66
|
+
|
67
|
+
:::term
|
68
|
+
$ mkdir log/; touch log/resque_worker_QUEUE.log # if it doesn't exist
|
69
|
+
$ nohup QUEUE=* rake resque:work & &> log/resque_worker_QUEUE.log
|
@@ -0,0 +1,76 @@
|
|
1
|
+
Device Authentication in RhoConnect
|
2
|
+
===
|
3
|
+
|
4
|
+
The generated RhoConnect application code includes a file at the root called "application.rb" which contains an "authenticate" hook. This method is called when a device first connects to the RhoConnect application and provides username/password credentials.
|
5
|
+
|
6
|
+
## Authentication Workflow
|
7
|
+
|
8
|
+
The following diagram shows how this authenticate method is called:
|
9
|
+
|
10
|
+
<img src="https://img.skitch.com/20110111-g2ujk785gak2kfgfrspq1w8u8j.png"/>
|
11
|
+
|
12
|
+
## Example
|
13
|
+
If your backend service requires authentication, simply add code to the authenticate method and return true if authentication was successful or false to deny access to the application from this device. For example:
|
14
|
+
|
15
|
+
:::ruby
|
16
|
+
def authenticate(username, password, session)
|
17
|
+
success = false
|
18
|
+
# ... connect to backend using API and authenticate ...
|
19
|
+
result = do_custom_authentication(username,password)
|
20
|
+
if result.code == 200
|
21
|
+
# save the data for later use in the source adapter
|
22
|
+
Store.put_value("username:#{username}:token",result.body)
|
23
|
+
success = true
|
24
|
+
end
|
25
|
+
return success
|
26
|
+
end
|
27
|
+
|
28
|
+
## Changing Login
|
29
|
+
If your actual user name is different than the username that is input into the client, you can change the username by returning a string instead of true if authentication was successful.
|
30
|
+
|
31
|
+
:::ruby
|
32
|
+
def authenticate(username, password, session)
|
33
|
+
success = false
|
34
|
+
# ... connect to backend using API and authenticate ...
|
35
|
+
result = do_custom_authentication(username,password)
|
36
|
+
if result.code == 200
|
37
|
+
new_user = custom_user_mapping(username)
|
38
|
+
# save the data for later use in the source adapter
|
39
|
+
Store.put_value("username:#{new_user}:token",result.body)
|
40
|
+
success = new_user
|
41
|
+
end
|
42
|
+
return success
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
## LDAP Example
|
47
|
+
The code sample above demonstrates authentication by calling a method you would implement called 'do_custom_authentication' that returns an HTTP response object, however the actual implementation is left as an exercise. If your application needs to connect to LDAP, you can use the following sample code to perform simple authentication:
|
48
|
+
|
49
|
+
:::ruby
|
50
|
+
require 'net/ldap'
|
51
|
+
|
52
|
+
def authenticate(username, password, session)
|
53
|
+
success = false
|
54
|
+
ldap = Net::LDAP.new
|
55
|
+
ldap.host = "localhost"
|
56
|
+
ldap.port = 389
|
57
|
+
ldap.auth "cn=#{username},dc=example,dc=com", password
|
58
|
+
|
59
|
+
# we only need to bind to verify successful login
|
60
|
+
success = true if ldap.bind
|
61
|
+
|
62
|
+
return success
|
63
|
+
end
|
64
|
+
|
65
|
+
Where the domain component "dc=example,dc=com" is replaced by your domain. For example, the `ldap.auth` code above using "rhomobile.com" would be:
|
66
|
+
|
67
|
+
:::ruby
|
68
|
+
ldap.auth "cn=#{username},dc=rhomobile,dc=com", password
|
69
|
+
|
70
|
+
This example uses the [net-ldap](https://github.com/RoryO/ruby-net-ldap) gem. To install this gem, run the following:
|
71
|
+
|
72
|
+
:::term
|
73
|
+
$ [sudo] gem install net-ldap
|
74
|
+
|
75
|
+
For more details about LDAP, please visit [http://www.openldap.org/](http://www.openldap.org/).
|
76
|
+
|
data/doc/benchmarks.txt
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
RhoConnect Benchmarks
|
2
|
+
===
|
3
|
+
|
4
|
+
Note, these numbers reflect synchronization performance using the rhoconnect bench utility (see the rhoconnect/bench folder for more information).
|
5
|
+
We will be adding more results as we test across different server environments.
|
6
|
+
|
7
|
+
|
8
|
+
Servers configuration (Amazon EC2 'm1.small' instances) :
|
9
|
+
|
10
|
+
* CPU Units - 1 ECU
|
11
|
+
|
12
|
+
* CPU Cores - 1 Core
|
13
|
+
|
14
|
+
* Memory - 1.7GB
|
15
|
+
|
16
|
+
* Platform - Ubuntu (2.6.38-8-virtual)
|
17
|
+
|
18
|
+
|
19
|
+
Environment (instance #1):
|
20
|
+
|
21
|
+
* Nginx 1.0.0
|
22
|
+
|
23
|
+
* Ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], Ruby Enterprise Edition 2011.03
|
24
|
+
|
25
|
+
* Passenger 3.0.7 (mod_rails)
|
26
|
+
|
27
|
+
* Redis 2.2.11
|
28
|
+
|
29
|
+
* Rhoconnect 3.0.0
|
30
|
+
|
31
|
+
Nginx configuration file:
|
32
|
+
|
33
|
+
<pre>
|
34
|
+
user www-data;
|
35
|
+
worker_processes 4;
|
36
|
+
|
37
|
+
pid /var/run/nginx.pid;
|
38
|
+
|
39
|
+
events {
|
40
|
+
worker_connections 1024;
|
41
|
+
}
|
42
|
+
|
43
|
+
http {
|
44
|
+
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.7;
|
45
|
+
passenger_ruby /usr/local/bin/ruby;
|
46
|
+
passenger_max_pool_size 20;
|
47
|
+
include mime.types;
|
48
|
+
default_type application/octet-stream;
|
49
|
+
|
50
|
+
sendfile on;
|
51
|
+
tcp_nopush on;
|
52
|
+
tcp_nodelay on;
|
53
|
+
|
54
|
+
keepalive_timeout 65;
|
55
|
+
|
56
|
+
gzip on;
|
57
|
+
|
58
|
+
server {
|
59
|
+
listen 80;
|
60
|
+
server_name ec2-50-18-72-186.us-west-1.compute.amazonaws.com;
|
61
|
+
root /var/www/benchapp/public; # Bench application #1
|
62
|
+
# root /var/www/blobapp/public; # Bench application #2
|
63
|
+
passenger_enabled on;
|
64
|
+
passenger_min_instances 6;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
</pre>
|
68
|
+
|
69
|
+
|
70
|
+
Environment (instance #2):
|
71
|
+
|
72
|
+
* Ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], Ruby Enterprise Edition 2011.03
|
73
|
+
|
74
|
+
* Rhoconnect 3.0.0 code with bench scripts
|
75
|
+
|
76
|
+
|
77
|
+
Server instance #1 is running rhoconnect bench applications,
|
78
|
+
the 2nd one executes rhoconnect bench scripts.
|
79
|
+
|
80
|
+
## Bench application #1
|
81
|
+
* Simulates creating multiple objects
|
82
|
+
|
83
|
+
* 100 concurrent users
|
84
|
+
|
85
|
+
* 1 device per user
|
86
|
+
|
87
|
+
* 20 object dataset
|
88
|
+
|
89
|
+
* each object has 7 attributes
|
90
|
+
|
91
|
+
* 904 total HTTP requests
|
92
|
+
|
93
|
+
<pre>
|
94
|
+
Request clientcreate : min: 0.0069, max: 1.6010, avg: 0.3404
|
95
|
+
Request ack-cud : min: 0.0339, max: 3.2250, avg: 0.5910
|
96
|
+
Request clientlogin : min: 0.0063, max: 0.8138, avg: 0.1216
|
97
|
+
Request get-cud : min: 0.0315, max: 3.0044, avg: 0.3988
|
98
|
+
Request create-object : min: 0.0791, max: 4.4959, avg: 1.3521
|
99
|
+
Throughput(req/s) : 7.13629650622702
|
100
|
+
Throughput(req/min) : 428.177790373621
|
101
|
+
</pre>
|
102
|
+
|
103
|
+
## Bench application #2
|
104
|
+
* Simulates creating multiple objects
|
105
|
+
|
106
|
+
* 100 concurrent users
|
107
|
+
|
108
|
+
* 1 device per user
|
109
|
+
|
110
|
+
* 10 object dataset
|
111
|
+
|
112
|
+
* each object has variable number of attributes (from 10 to 60) + image
|
113
|
+
|
114
|
+
* 904 total HTTP requests
|
115
|
+
|
116
|
+
<pre>
|
117
|
+
Request clientcreate : min: 0.0067, max: 2.9286, avg: 0.6870
|
118
|
+
Request ack-cud : min: 0.0473, max: 5.5015, avg: 1.6219
|
119
|
+
Request clientlogin : min: 0.0061, max: 3.2326, avg: 0.4687
|
120
|
+
Request get-cud : min: 0.0382, max: 7.2202, avg: 1.0975
|
121
|
+
Request create-object : min: 0.3765, max: 11.1387, avg: 5.1424
|
122
|
+
Throughput(req/s) : 7.22833609137099
|
123
|
+
Throughput(req/min): 433.700165482259
|
124
|
+
</pre>
|
125
|
+
|
126
|
+
## Prepare bench applications for running on server #1
|
127
|
+
|
128
|
+
Go to rhoconnect/bench directory and configure benchapp application:
|
129
|
+
|
130
|
+
<pre>
|
131
|
+
sudo cp -R benchapp /var/www/
|
132
|
+
cd /var/www/
|
133
|
+
sudo mkdir benchapp/public
|
134
|
+
sudo chown -R www-data:www-data benchapp/
|
135
|
+
</pre>
|
136
|
+
|
137
|
+
Do the same for blobapp bench:
|
138
|
+
<pre>
|
139
|
+
sudo cp -R blobapp /var/www/
|
140
|
+
cd /var/www/
|
141
|
+
sudo mkdir blobapp/public
|
142
|
+
sudo chown -R www-data:www-data blobapp/
|
143
|
+
</pre>
|
144
|
+
|
145
|
+
Edit <b>Nginx</b> configuration file, set server_name and root properties to public DNS server name
|
146
|
+
and bench application public folder respectively. After restarting server make sure that bench application is
|
147
|
+
running by visiting its web concole, i.e. :
|
148
|
+
<pre>
|
149
|
+
http://server_dns_public_name/console/
|
150
|
+
</pre>
|
151
|
+
|
152
|
+
## How to execute bench scripts on server #2
|
153
|
+
Before running bench scripts you need configure bench application settings properly.
|
154
|
+
|
155
|
+
Edit rhoconnect/bench/benchapp/settings/settings.yml and set redis and syncserver properties:
|
156
|
+
<pre>
|
157
|
+
:development:
|
158
|
+
:licensefile: settings/license.key
|
159
|
+
:redis: server_ip_address:6379
|
160
|
+
:syncserver: http://server_dns_public_name:80/api/application/
|
161
|
+
</pre>
|
162
|
+
|
163
|
+
Do the same for blobapp settings.yml file.
|
164
|
+
|
165
|
+
Then from rhoconnect/becnh directory execute run_cud_script.sh and run_blob_script.sh scripts respectively.
|
166
|
+
|
167
|
+
|
168
|
+
|
data/doc/blob-sync.txt
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
Binary Objects and Blob Sync
|
2
|
+
===
|
3
|
+
Synchronizing images or binary objects between RhoConnect and the client is declared by having a 'blob attribute' on the [Rhom model](/rhodes/rhom). This instructs the client to download the blob attribute's value (in this case a url) separately from the rest of the data and save it to the device file system.
|
4
|
+
|
5
|
+
**NOTE: The example below shows how to synchronize an image created by the device's camera, but could be applied to any arbitrary files on the device.**
|
6
|
+
|
7
|
+
## Synchronizing from Device to RhoConnect
|
8
|
+
Suppose you have a [Rhom model](/rhodes/rhom) called "Image" and you have a [camera callback function](/rhodes/device-caps#camera) defined in the Image model's controller:
|
9
|
+
|
10
|
+
:::ruby
|
11
|
+
def camera_callback
|
12
|
+
if @params['status'] == 'ok'
|
13
|
+
#create image record in the DB
|
14
|
+
image = Image.new({'image_uri'=>@params['image_uri']})
|
15
|
+
image.save
|
16
|
+
SyncEngine.dosync
|
17
|
+
end
|
18
|
+
#reply on the callback
|
19
|
+
render :action => :ok, :layout => false
|
20
|
+
end
|
21
|
+
|
22
|
+
When this is executed in a Rhodes application:
|
23
|
+
|
24
|
+
* This callback triggers a sync after saving saving an image.
|
25
|
+
|
26
|
+
* Then Rhodes will push the image file to the RhoConnect application by HTTP POST.
|
27
|
+
|
28
|
+
* `application.rb#store_blob` is called for optional pre-processing of the file. This is useful in cases where you want to preserve the filename that Rhodes sent.
|
29
|
+
|
30
|
+
The following example stores the `:filename` argument as another object attribute.
|
31
|
+
|
32
|
+
:::ruby
|
33
|
+
def store_blob(obj,field_name,blob)
|
34
|
+
obj['filename'] = blob[:filename]
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
* The RhoConnect source adapter tied to this Rhom model processes the blob in the `create` method.
|
39
|
+
|
40
|
+
The following example takes the blob and stores it in S3:
|
41
|
+
|
42
|
+
:::ruby
|
43
|
+
def create(create_hash,blob)
|
44
|
+
# this would be a blob attribute, points to a tempfile
|
45
|
+
# containing the raw post data
|
46
|
+
name = create_hash["image_uri"]
|
47
|
+
|
48
|
+
# filename we saved in application.rb#store_blob method
|
49
|
+
basename = create_hash["filename"]
|
50
|
+
S3Object.store(
|
51
|
+
basename,
|
52
|
+
open(name),
|
53
|
+
@bucket,
|
54
|
+
:access => :public_read
|
55
|
+
)
|
56
|
+
basename #=> object id here is the filename
|
57
|
+
end
|
58
|
+
|
59
|
+
In this example, we store the image blob to s3 so we can query it later. See the "image" source adapter that comes with [the rhodes-samples-server](https://github.com/rhomobile/rhodes-samples-server/blob/master/sources/image.rb).
|
60
|
+
|
61
|
+
## Query for Blobs in the Source Adapter
|
62
|
+
|
63
|
+
In your query call, you should store the URL to images in the blob attribute so that the device can fetch the image when it synchronizes.
|
64
|
+
|
65
|
+
:::ruby
|
66
|
+
def query(params=nil)
|
67
|
+
@result={}
|
68
|
+
Bucket.find(@bucket).objects.each do |entry|
|
69
|
+
new_item = {
|
70
|
+
'image_uri-rhoblob' => @baseurl+@bucket+'/'+File.basename(entry.key)
|
71
|
+
}
|
72
|
+
@result[entry.key] = new_item
|
73
|
+
end
|
74
|
+
@result
|
75
|
+
end
|
76
|
+
|
77
|
+
Here we save the image URL to an attribute `image_uri-rhoblob`. This will correspond to the `image_uri` attribute in our Rhom model above.
|
78
|
+
|
79
|
+
**NOTE: In order for Rhodes to automatically recognize a blob attribute, the attribute name must end with "-rhoblob". In the above example, `image_uri` was our Rhom attribute, so our source adapter assigned `image_uri-rhoblob` with the blob URL.**
|
80
|
+
|
81
|
+
A complete image source adapter that stores files in S3 might look like:
|
82
|
+
|
83
|
+
:::ruby
|
84
|
+
require 'aws/s3'
|
85
|
+
class Image < SourceAdapter
|
86
|
+
include AWS::S3
|
87
|
+
|
88
|
+
|
89
|
+
def initialize(source,credential)
|
90
|
+
AWS::S3::Base.establish_connection!(
|
91
|
+
:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
|
92
|
+
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
|
93
|
+
)
|
94
|
+
@baseurl = 'http://s3.amazonaws.com/'
|
95
|
+
@bucket = 'rhodes-samples-images'
|
96
|
+
super(source,credential)
|
97
|
+
end
|
98
|
+
|
99
|
+
def query(params=nil)
|
100
|
+
@result={}
|
101
|
+
Bucket.find(@bucket).objects.each do |entry|
|
102
|
+
new_item = {
|
103
|
+
'image_uri-rhoblob' => @baseurl+@bucket+'/'+File.basename(entry.key)
|
104
|
+
}
|
105
|
+
@result[entry.key] = new_item
|
106
|
+
end
|
107
|
+
@result
|
108
|
+
end
|
109
|
+
|
110
|
+
def create(create_hash)
|
111
|
+
puts "Creating: #{create_hash.inspect}"
|
112
|
+
name = create_hash["image_uri"]
|
113
|
+
basename = create_hash["filename"]
|
114
|
+
S3Object.store(
|
115
|
+
basename,
|
116
|
+
open(name),
|
117
|
+
@bucket,
|
118
|
+
:access => :public_read
|
119
|
+
)
|
120
|
+
basename
|
121
|
+
end
|
122
|
+
|
123
|
+
def delete(delete_hash)
|
124
|
+
puts "Removing: #{delete_hash.inspect}"
|
125
|
+
S3Object.delete delete_hash['id'], @bucket
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
## Rhodes Sample Code
|
130
|
+
See controller and view in the `/app/Blob` directory of the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master) for a complete Rhodes code sample.
|
data/doc/bulk-sync.txt
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
Bulk Sync
|
2
|
+
===
|
3
|
+
During the initial sync process in your applcation, you may need to deliver a large number of objects. This may result in many megabytes of data being sent to the device. In this case, incremental synchronization may take a while to complete since it uses JSON as the wire format. To significantly speed up this process you may use RhoConnect's "bulk sync" feature.
|
4
|
+
|
5
|
+
## Bulk Sync Process
|
6
|
+
|
7
|
+
If and when the Rhodes application issues a request to get bulk data, the RhoConnect application will do following:
|
8
|
+
|
9
|
+
* Queue a [resque background job](http://github.com/defunkt/resque) which will run the bulk sync process.
|
10
|
+
|
11
|
+
* Execute the ['login,'query','logoff' methods](/rhoconnect/source-adapters#source-adapter-api) of all source adapters matching the [requested data partition](/rhoconnect/source-adapters#data-partitioning) to get latest set of objects from the backend service
|
12
|
+
|
13
|
+
* Generate appropriate database files for the device - hsqldb for Blackberry and sqlite for the rest of them. RhoConnect will generate sqlite files for iOS, Android, and Windows Mobile clients and hsqldb files for Blackberry (if enabled).
|
14
|
+
|
15
|
+
* The Rhodes application will poll RhoConnect for the bulk sync job to finish. Once the job is finished, the files are generated and Rhodes will download and install them to the device.
|
16
|
+
|
17
|
+
**NOTE: Be cautious using this in your application - any previous set of objects on the device will be replaced with the latest set from the backend service.**
|
18
|
+
|
19
|
+
Once the bulk data sync process is complete for a source, you may continue to synchronize sources using the default incremental sync process. However, the default sync process may be disabled for a source by setting its `sync_type` to 'bulk_sync_only'. This will save space in your redis database if you don't plan on using incremental sync for this source.
|
20
|
+
|
21
|
+
For example, your settings/settings.yml might have:
|
22
|
+
|
23
|
+
:::yaml
|
24
|
+
:sources:
|
25
|
+
Product:
|
26
|
+
poll_interval: 300
|
27
|
+
Customer:
|
28
|
+
poll_interval: 300
|
29
|
+
sync_type: bulk_sync_only
|
30
|
+
|
31
|
+
## Setup
|
32
|
+
|
33
|
+
### Enabling Bulk Sync in Rhodes
|
34
|
+
In the device rhodes application, setting `bulksync_state` to 0 in rhoconfig.txt will trigger bulk sync next time sync is performed:
|
35
|
+
|
36
|
+
bulksync_state = 0
|
37
|
+
|
38
|
+
After application executed bulk sync it will set `bulksync_state` to 1 and next time sync will happen, it will not execute bulk sync anymore. You may force bulk sync on the next sync cycle by setting `bulksync_state` to 0 again using ruby in your application:
|
39
|
+
|
40
|
+
:::ruby
|
41
|
+
Rho::RhoConfig.bulksync_state = '0'
|
42
|
+
|
43
|
+
### Enabling BlackBerry Bulk Sync
|
44
|
+
If your application will be performing bulk sync for BlackBerry devices, you will need to install the open source Rhomobile HSQLDB tool [hsqldata.jar](http://github.com/rhomobile/hsqldata) in your RhoConnect application.
|
45
|
+
|
46
|
+
1. Download [hsqldata](http://github.com/rhomobile/hsqldata/zipball/0.0.2).
|
47
|
+
|
48
|
+
2. Build and install hsqldata.jar into your RhoConnect application:
|
49
|
+
|
50
|
+
:::term
|
51
|
+
$ cd hsqldata
|
52
|
+
$ ant
|
53
|
+
$ mkdir <path-to-rhoconnect-app>/vendor
|
54
|
+
$ cp bin/hsqldata.jar <path-to-rhoconnect-app>/vendor/
|
55
|
+
|
56
|
+
3. Next set the `:blackberry_bulk_sync:` flag in settings/settings.yml:
|
57
|
+
|
58
|
+
:::yaml
|
59
|
+
:development:
|
60
|
+
:licensefile: settings/license.key
|
61
|
+
:redis: localhost:6379
|
62
|
+
:syncserver: http://localhost:9292/application/
|
63
|
+
:blackberry_bulk_sync: true
|
64
|
+
|
65
|
+
## Data Files
|
66
|
+
|
67
|
+
By default, bulk sync data files will be stored in the application's root folder, under a 'data' directory. When bulk data is requested by the Rhodes application, RhoConnect will return a link to the file if the `bulk_sync_poll_interval` has not expired. If the file is expired, RhoConnect will return a wait command to Rhodes and enqueue another [resque job](http://github.com/defunkt/resque) to generate new bulk data files. By default, the `bulk_sync_poll_interval` is set to 1 hour (3600) seconds and is configurable in `settings.yml`:
|
68
|
+
|
69
|
+
:::yaml
|
70
|
+
:development:
|
71
|
+
:redis: localhost:6379
|
72
|
+
:licensefile: settings/license.key
|
73
|
+
:syncserver: http://localhost:9292/application/
|
74
|
+
:bulk_sync_poll_interval: 3600
|
75
|
+
|
76
|
+
## Using Bulk Sync with Fixed Schema Models
|
77
|
+
|
78
|
+
If your Rhom model is a [fixed schema model](/rhodes/rhom#fixed-schema) and you use bulk sync, you can control the bulk sync schema at runtime in your source adapter by implementing the 'schema' method.
|
79
|
+
|
80
|
+
**NOTE: This method must return a JSON string. This JSON string is sent to the Rhodes application and used to dynamically build the database schema.**
|
81
|
+
|
82
|
+
An example schema method is as follows:
|
83
|
+
|
84
|
+
:::ruby
|
85
|
+
def schema
|
86
|
+
{
|
87
|
+
'version' => '1.0',
|
88
|
+
'property' => {
|
89
|
+
'name' => 'string',
|
90
|
+
'brand' => 'string',
|
91
|
+
'price' => 'string',
|
92
|
+
'image_url_cropped' => 'blob,overwrite',
|
93
|
+
'image_url' => 'blob'
|
94
|
+
},
|
95
|
+
'index' => {
|
96
|
+
'by_name_brand' => 'name,brand'
|
97
|
+
},
|
98
|
+
'unique_index' => {
|
99
|
+
'by_price' => 'price'
|
100
|
+
}
|
101
|
+
}.to_json
|
102
|
+
end
|