{"action":"opened","issue":{"url":"https://api.github.com/repos/r-simmer/simmer.bricks/issues/8","repository_url":"https://api.github.com/repos/r-simmer/simmer.bricks","labels_url":"https://api.github.com/repos/r-simmer/simmer.bricks/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/r-simmer/simmer.bricks/issues/8/comments","events_url":"https://api.github.com/repos/r-simmer/simmer.bricks/issues/8/events","html_url":"https://github.com/r-simmer/simmer.bricks/issues/8","id":347609466,"node_id":"MDU6SXNzdWUzNDc2MDk0NjY=","number":8,"title":"On-demand arrivals","user":{"login":"Enchufa2","id":4542928,"node_id":"MDQ6VXNlcjQ1NDI5Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/4542928?v=4","gravatar_id":"","url":"https://api.github.com/users/Enchufa2","html_url":"https://github.com/Enchufa2","followers_url":"https://api.github.com/users/Enchufa2/followers","following_url":"https://api.github.com/users/Enchufa2/following{/other_user}","gists_url":"https://api.github.com/users/Enchufa2/gists{/gist_id}","starred_url":"https://api.github.com/users/Enchufa2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Enchufa2/subscriptions","organizations_url":"https://api.github.com/users/Enchufa2/orgs","repos_url":"https://api.github.com/users/Enchufa2/repos","events_url":"https://api.github.com/users/Enchufa2/events{/privacy}","received_events_url":"https://api.github.com/users/Enchufa2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-04T10:48:34Z","updated_at":"2018-08-04T10:48:34Z","closed_at":null,"author_association":"MEMBER","body":"Example:\r\n\r\n```r\r\nlibrary(simmer)\r\n\r\nenv <- simmer()\r\n\r\ntrigger_arrivals <- function(.trj, source, n=1) {\r\n  .trj %>%\r\n    set_source(source, at(rep(0, n))) %>%\r\n    activate(source)\r\n}\r\n\r\nadd_idle_source <- function(.env, name_prefix, trajectory, ...) {\r\n  .env %>%\r\n    add_generator(name_prefix, trajectory, at(-1), ...)\r\n}\r\n\r\nrestock <- trajectory() %>%\r\n  log_(\"restock\")\r\n\r\nserve <- trajectory() %>%\r\n  log_(\"serve\") %>%\r\n  trigger_arrivals(\"Restock\")\r\n\r\nenv %>%\r\n  add_generator(\"Customer\", serve, at(1, 2, 3)) %>%\r\n  add_idle_source(\"Restock\", restock) %>%\r\n  run()\r\n```"}}
{"actor":{"display_login":"Enchufa2"}}