Some useful Postgres configuration changes for a dev machine:
log_connections = on
log_disconnections = on
log_statement = 'all'
Optionally, set log timestamps to local time
log_timezone = 'US/Central' # Or whatever your timezone is
| 12 Fallacies of Distributed Computing | |
| 1. The network is reliable (Bill Joy, Tom Lyon) | |
| 2. Latency isn't a problem (Bill Joy, Tom Lyon) | |
| 3. Bandwidth isn't a problem (Bill Joy, Tom Lyon) | |
| 4. The network is secure (Bill Joy, Tom Lyon) | |
| 5. The topology won't change (Peter Deutsch) | |
| 6. The administrator will know what to do (Peter Deutsch) | |
| 7. Transport cost isn't a problem (Peter Deutsch) | |
| 8. The network is homogeneous (James Gosling) |
| class SomeClass | |
| def some_method | |
| end | |
| end | |
| C = Class.new(SomeClass) | |
| m = C.instance_method(:some_method) | |
| pp m.owner |
Some useful Postgres configuration changes for a dev machine:
log_connections = on
log_disconnections = on
log_statement = 'all'
Optionally, set log timestamps to local time
log_timezone = 'US/Central' # Or whatever your timezone is
| GEM | |
| remote: https://rubygems.org/ | |
| specs: | |
| confstruct (1.0.2) | |
| hashie (~> 3.3) | |
| eventide-postgres (1.0.0.0) | |
| evt-consumer-postgres | |
| evt-entity_snapshot-postgres | |
| evt-entity_store | |
| evt-async_invocation (1.0.0.0) |
| class Consumer | |
| include Consumer::Postgres | |
| handler SomeHandler | |
| handler SomeOtherHandler | |
| def error_raised(error, message_data) | |
| if error.instance_of?(MessageStore::ExpectedVersion::Error) | |
| self.(message_data) | |
| else |
| handle Deposit do |deposit| | |
| account_id = deposit.account_id | |
| sequence = deposit.metadata.global_position | |
| # Retry once if an expected version error is raised by the write | |
| Retry.(MessageStore::ExpectedVersion::Error) do | |
| account, version = store.fetch(account_id, include: :version) | |
| # Idempotence protection using sequence numbers | |
| unless sequence > account.sequence |
| handle SomeMessage do |some_message| | |
| post_data = PostData.build(some_message) | |
| Retry.(HTTPError, millisecond_intervals: [100, 200]) do | |
| SomeHttpAPI.post(post_data) | |
| end | |
| end |
| class Consumer | |
| # ... | |
| def error_raised(error, message_data) | |
| # Do something with the error | |
| raise error | |
| end | |
| end |
| ComponentHost.start(component_name) do |host| | |
| # ... | |
| host.record_error(error) do | |
| SomeErrorReporter.(error) | |
| end | |
| end |
| module Events | |
| class Opened | |
| include Messaging::Message | |
| attribute :account_id, String | |
| attribute :customer_id, String | |
| attribute :time, String | |
| end | |
| class Deposited |