Class: PgLogicalReplicator::ReplicationStopper
- Inherits:
-
Object
- Object
- PgLogicalReplicator::ReplicationStopper
- Defined in:
- lib/pg_logical_replicator/replication_stopper.rb
Instance Method Summary collapse
-
#initialize(source_config, target_config) ⇒ ReplicationStopper
constructor
A new instance of ReplicationStopper.
- #stop_replication ⇒ Object
Constructor Details
#initialize(source_config, target_config) ⇒ ReplicationStopper
Returns a new instance of ReplicationStopper.
5 6 7 8 |
# File 'lib/pg_logical_replicator/replication_stopper.rb', line 5 def initialize(source_config, target_config) @source_config = source_config @target_config = target_config end |
Instance Method Details
#stop_replication ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pg_logical_replicator/replication_stopper.rb', line 10 def stop_replication source_conn = PG.connect(@source_config) target_conn = PG.connect(@target_config) begin drop_all_publications(source_conn) drop_all_subscriptions(target_conn) puts "All replication stopped successfully." ensure source_conn.close if source_conn target_conn.close if target_conn end end |