Skip to content

A Clojang life-cycle implementation of the Component library for use in large/complex applications

License

Notifications You must be signed in to change notification settings

clojang/component

Repository files navigation

component

Build Status Dependencies Status Clojars Project

A Clojang life-cycle implementation of the Component library for use in large/complex applications

Project logo

Contents

About

While the Clojang agent is useful for emulating some of the convenience of the Erlang shell and LFE REPL, it may be too fragile for systems deployments, or a developer may prefer to use more common idioms in Clojure deployments, namely the use of the Component library.

This project provides the same functionality that the agent does, but in a form that can be easily integrated with other Clojure components as part of a larger system. In particular, a default node component is provided -- this may be either used as is, or as the basis of a customized component, specially suited for your needs.

Usage

Basic usage is as follows:

  1. Start up the REPL:
$ lein repl

  ___| |      _)
 |     |  _ \  |  _` | __ \   _` |
 |     | (   | | (   | |   | (   |
\____|_|\___/  |\__,_|_|  _|\__, |
           ___/             |___/
----------      ------------     -
-  c o m p o n e n t  ------------
----------------------------------

Clojure 1.9.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_161-b12
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

[clojang.component.repl] λ=>
  1. Start the Clojang default node component, which is part of the sample system:
[clojang.component.repl] λ=> (startup)
2018-08-04T15:33:05.475 [nREPL-worker-0] INFO clojang.component.components.config:39 - Starting config component ...
2018-08-04T15:33:05.510 [nREPL-worker-0] DEBUG clojang.component.components.config:40 - Started config component.
2018-08-04T15:33:05.513 [nREPL-worker-0] INFO clojang.component.components.logging:16 - Starting logging component ...
2018-08-04T15:33:05.514 [nREPL-worker-0] DEBUG clojang.component.components.logging:19 - Setting up logging with level :debug
2018-08-04T15:33:05.514 [nREPL-worker-0] DEBUG clojang.component.components.logging:20 - Logging namespaces: [clojang com.ericsson.otp.erlang jiface]
2018-08-04T15:33:05.519 [nREPL-worker-0] DEBUG clojang.component.components.logging:22 - Started logging component.
2018-08-04T15:33:05.520 [nREPL-worker-0] INFO clojang.component.components.epmd:45 - Starting Erlang Port Mapper Daemon component ...
2018-08-04T15:33:05.644 [nREPL-worker-0] DEBUG clojang.component.components.epmd:57 - Started the Erlang Port Mapper Daemon process.
2018-08-04T15:33:05.644 [nREPL-worker-0] DEBUG clojang.component.components.epmd:58 - Started Erlang Port Mapper Daemon component.
2018-08-04T15:33:05.646 [nREPL-worker-0] INFO clojang.component.components.default-node:23 - Starting default node component ...
2018-08-04T15:33:05.648 [nREPL-worker-0] INFO clojang.agent.startup:34 - Bringing up OTP node on clojang@spacemac ...
2018-08-04T15:33:05.657 [nREPL-worker-0] INFO clojang.agent.startup:26 - Registered nodes with message boxes: ["default"]
:running
  1. Make calls using the convencient API at clojang.component.core:
[clojang.component.repl] λ=> (core/node-name)
"clojang@spacemac"
[clojang.component.repl] λ=> (core/node)
#object[com.ericsson.otp.erlang.OtpNode 0x5afcf7e7 "clojang@spacemac"]
[clojang.component.repl] λ=> (core/mbox)
#object[com.ericsson.otp.erlang.OtpMbox 0x30cccc6c "com.ericsson.otp.erlang.OtpMbox@d8fa7fbe"]
[clojang.component.repl] λ=> (core/mbox-name)
"default"

Note that this example component makes use of the same JVM options that the Clojang agent does, as defined in the project.clj (:dev profile, :jvm-opts).

Donating

A donation account for supporting development on this project has been set up on Liberapay here:

You can learn more about Liberapay on its Wikipedia entry or on the service's "About" page.

License

Copyright © 2018 The Clojang Project

Distributed under the Apache License Version 2.0.

About

A Clojang life-cycle implementation of the Component library for use in large/complex applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published