Events Development: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
m (Ovidiu moved page Esa Development to Events Development without leaving a redirect)
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


* [[esa]]
* [[events]]


 
=TODO=
To clone:


<pre>
<pre>
git clone git@github.com:NovaOrdis/esa.git
doc/events TODO.docx
</pre>
</pre>


=Clone=


=TODO=
<pre>
 
git clone git@github.com:NovaOrdis/events.git
doc/Event Development.docx TODO section.
</pre>


=Development=
=Development=
Line 21: Line 21:
This will install a new unnumbered (same release number) "development" release locally:
This will install a new unnumbered (same release number) "development" release locally:
<pre>
<pre>
cdesa
cdevents
mvn clean install; ./bin/install -f
mvn clean install; ./bin/install -f
</pre>
</pre>
Line 27: Line 27:
==Numbered Release==
==Numbered Release==


1. Increment (or update) the version information from <tt>$PROJECT_HOME/pom.xml</tt>.
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
 
:[[Public Release Procedure for Projects]]
2. Build and install
</blockquote>
 
<tt>-f</tt> is not necessary:
 
<pre>
mvn clean install; ./bin/install
</pre>
 
3. Check in
 
<pre>
mvn clean
git add .
git commit -m "starting ... version"
git push
</pre>


==Individual Unit Test==
==Individual Unit Test==
Line 51: Line 36:
mvn -Dmaven.surefire.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5012" -Dtest=EventsApplicationRuntimeTest clean test
mvn -Dmaven.surefire.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5012" -Dtest=EventsApplicationRuntimeTest clean test
</pre>
</pre>


=How to add New Commands=
=How to add New Commands=
Line 64: Line 48:


* The pipeline is initialized by the runtime, but there is no queue between the event processor and terminator. The command must install it.
* The pipeline is initialized by the runtime, but there is no queue between the event processor and terminator. The command must install it.
* The command executes on the main thread and might exit (and kill the JVM in the process) before the terminator had a chance to process its queue. Always register an EndOfStreamListerer with the terminator and wait on the main thread until that listener is notified.
<pre>
Terminator terminator = runtime.getTerminator();
final CountDownLatch rendezVous = new CountDownLatch(1);
terminator.addEndOfStreamListener(new EndOfStreamListener() {
  @Override
  public void eventStreamEnded() {
        rendezVous.countDown();
    }
});
// ...
//
// wait until terminator finishes its queue
//
rendezVous.await();
</pre>
or, better yet:
<pre>
runtime.waitForEndOfStream();
</pre>

Latest revision as of 21:00, 28 April 2017

Internal

TODO

doc/events TODO.docx

Clone

git clone git@github.com:NovaOrdis/events.git

Development

Unnumbered Development Release

This will install a new unnumbered (same release number) "development" release locally:

cdevents
mvn clean install; ./bin/install -f

Numbered Release

Public Release Procedure for Projects

Individual Unit Test

mvn -Dmaven.surefire.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5012" -Dtest=EventsApplicationRuntimeTest clean test

How to add New Commands

This is how you code new clad commands:

Clad User Manual

A few things to keep in mind:

  • The pipeline is initialized by the runtime, but there is no queue between the event processor and terminator. The command must install it.
  • The command executes on the main thread and might exit (and kill the JVM in the process) before the terminator had a chance to process its queue. Always register an EndOfStreamListerer with the terminator and wait on the main thread until that listener is notified.

Terminator terminator = runtime.getTerminator();

final CountDownLatch rendezVous = new CountDownLatch(1);

terminator.addEndOfStreamListener(new EndOfStreamListener() {
   @Override
   public void eventStreamEnded() {
        rendezVous.countDown();
    }
});

// ...

//
// wait until terminator finishes its queue
//
rendezVous.await();

or, better yet:

runtime.waitForEndOfStream();