View Source LocationSimulator

Use for simulating location(longitude, latitude) data. Support scalable for test workload.

achitecture

Achitecture

The library has 3 main part:

  1. Supervisor. Lib uses DynamicSupervisor for creating worker from config
  2. Worker. Generating GPS with user config
  3. Callback module. This is defined by user to handle event from worker

api-call-flow

Api call flow

sequenceDiagram
    participant CallbackMod
    participant Worker
    participant Api
    participant Sup

    Api->>Sup: Start with workers from config
    Sup->>Worker: Start GPS generator
    Worker->>CallbackMod: call start event
    Worker->>CallbackMod: call gps event
    Worker->>CallbackMod: call stop event

(for in local you need install extension to view flow)

installation

Installation

Library can be installed by adding location_simulator to your list of dependencies in mix.exs:

def deps do
  [
    {:location_simulator, "~> 0.1.2"}
  ]
end

If you need to modify source please go to Github and clone repo.

guide

Guide

Start LocationSimulator with default config:

LocationSimulator.start()

With default config simulator will print to Logger with default config

Start with your callback & config:

config =
    %{
      worker: 3,
      event: 100,
      interval: 1000,
      random_range: 0,
      callback: MyCallbackModule
    }

LocationSimulator.start(config)

example

Example

Start library in Elixir's shell:

mix deps.get

iex -S mix

iex(1)> LocationSimulator.start()

For writing callback module please go to callback_event document.