Skip to content

sb8244/pg2_demo

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 

Pg2Demo

This repo is a demo of pg2 for synchronization of related processes across the cluster

Demo

  1. mix deps.get
  2. mix compile
  3. Run the following in 2 consoles
elixir --name 2@127.0.0.1 -S mix run --no-halt
elixir --name 3@127.0.0.1 -S mix run --no-halt
  1. In a 4th console, run iex --name 1@127.0.0.1 -S mix
  2. In the 4th console, play with commands like:
Pg2Demo.connect()
Node.list() # [:"2@127.0.0.1", :"3@127.0.0.1"]

Pg2Demo.update()
# Sending update on {:sync_demo, Pg2Demo.Synchronization} to #PID<14511.108.0>
# Sending update on {:sync_demo, Pg2Demo.Synchronization} to #PID<14592.122.0>

# target prints: Received update on {:sync_demo, Pg2Demo.Synchronization} with test

About

A demo of pg2 in elixir

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages