Giter VIP home page Giter VIP logo

nova's Introduction

Nova

Maven Central Codeship Status for oli-d/nova Codacy Badge

Quality gate

Security Rating Reliability Rating Maintainability Rating

Lines of Code Vulnerabilities SonarCloud Bugs Code Smells Technical Debt

1. Why?

The goal of this project is to provide a small and easy-to-use library that enables developers to rapidly build systems or services in an "event driven, asynchronous and reactive style".

The origins of the API were heavily influenced by Node.js and its underlying programming model, hence the name (Node for Java). This programming model, which (for those who have no experience with Node.js) is based on single-threaded event processing, prove itself to be very helpful in eliminating nasty concurrency bugs and to allow the programmer to fully concentrate on the business logic.

However, as everything in life, this also came with a downside. Mainly, there were three things we had to fight with

  1. call back hell for business logic that depends on multiple data sources,
  2. the need to split a long running execution into various parts and emit artificial "sub events", and
  3. improper event processing can easily block your one and only thread, rendering the whole service unresponsive.

Therefore, we changed the philosophy (and implementation) of the library and based it on RxJava (2.0) to promote a fully reactive way of programming.

  • Being reactive makes it very easy to express business logic based on various information sources and define "if this than that" scenarios.
  • To the client, it is completely transparent whether information is delivered synchronously or asynchronously
  • The client is under full control over the threading model. It can chose to go single threaded (if it has to mutate shared state) or multi threaded (for full system performance) at will. Going fully functional even eliminates that question

2. What's included?

Nova provides a couple of very small libraries. Those libraries try to focus on one (and only one) problem and try to solve it in a consistent way, making it easy to combine them. They provide solutions for common, technical problems, allowing service developers to concentrate on the required business logic.

Currently, the following libraries exist:

  • Core functionality

    • core: core functionality, used by all other components
  • Communication

    • comm: communication base library providing protocol agnostic, reactive message sending and retrieval
    • jms: reactive JMS messaging
  • spring-boot related

    • nova-starter: Module to conveniently use Nova functionality with spring-boot

3. How do I integrate it in my projects?

The easiest way is to retrieve Nova from Maven central. We recommend you are using maven's dependency management feature and import the BOM, so that you can be sure that all included modules properly work with each other:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>ch.squaredesk.nova</groupId>
            <artifactId>bom</artifactId>
            <version>10.0.0</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencymanagement>

nova's People

Contributors

oli-d avatar hochraldo avatar peregin avatar oreinert avatar

Stargazers

Eliezer Herrera avatar  avatar TwoProblems avatar Andreas F. Bobak avatar  avatar  avatar Maximilian Antoni avatar

Watchers

 avatar  avatar Chatar Pal avatar

nova's Issues

WARN if @OnEvent annotated methods are not public

Currently, the BeanExaminer uses class.getMethods() whicg only returns public methods. Therefore, if you annotate a default or package protected method, it will not be picked up and you don't see anything in the logs.

Disable WADL creation for REST endpoints by default

https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/wadl.html#d0e13291

WADL generation is enabled in Jersey by default. This means that OPTIONS methods are added by default to each resource and an auto-generated /application.wadl resource is deployed too. To override this default behavior and disable WADL generation in Jersey, setup the configuration property in your application:
jersey.config.server.wadl.disableWadl=true
This property can be setup in a web.xml if the Jersey application is deployed in the servlet with web.xml or the property can be returned from the Application.getProperties(). See Deployment chapter for more information on setting the application configuration properties in various deployments.
WADL support in Jersey is implemented via ModelProcessor extension. This implementation enhances the application resource model by adding the WADL providing resources. WADL ModelProcessor priority value is high (i.e. the priority is low) as it should be executed as one of the last model processors. Therefore, any ModelProcessor executed before will not see WADL extensions in the resource model. WADL handling resource model extensions (resources and OPTIONS resource methods) are not added to the application resource model if there is already a matching resource or a resource method detected in the model. In other words, if you define for example your own OPTIONS method that would produce "application.wadl" response content, this method will not be overridden by WADL model processor. See Resource builder chapter for more information on ModelProcessor extension mechanism.

Allow custom defaultErrorPageGenerator to be set

HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(
baseUri,
resourceConfig,
false // so Grizzly won't start automatically
);

httpServer.getServerConfiguration().setDefaultErrorPageGenerator(...);

httpServer.start();

Bug in HttpServerConfigurationProvidingConfiguration - wrong SSL options mapping

The name of the bean methods doesn't correspong with the key returned from environment resulting a mess up.

@bean("httpServerTrustStore")
public String sslTrustStorePass() { // it should be sslTrustStorePath
return environment.getProperty("NOVA.HTTP.SERVER.TRUST_STORE");
}
@bean("httpServerTrustStorePass")
public String sslTrustStorePath() { // is shold be sslTrustStorePass
return environment.getProperty("NOVA.HTTP.SERVER.TRUST_STORE_PASS");
}

Exactly the same problem is with key store options:

@bean("httpServerKeyStore")
public String sslKeyStorePass() { // is shold be sslKeyStorePath
return environment.getProperty("NOVA.HTTP.SERVER.KEY_STORE");
}
@bean("httpServerKeyStorePass")
public String sslKeyStorePath() {// is shold be sslKeyStorePass
return environment.getProperty("NOVA.HTTP.SERVER.KEY_STORE_PASS");
}

ElasticMetricsReporter should properly format timestamp values

The ElasticMetricsReporter has a problem in v 6.0.0 with _@timestamp field set - it puts the LocalDateTime object and ES fails to index because of that - it should be a numeric timestamp; see:
LocalDateTime timestampInUtc = timestampInUtc(metricsDump.timestamp);
additionalAttributes.put("@timestamp", timestampInUtc);
Beside that additionalMetricAttributes field is not used anymore in the methods that are at the moment doing push to ES.

something like this should fix it:

private long timestampInUtc(long timestampInMillis) {
return Instant.ofEpochMilli(timestampInMillis).atZone(zoneForTimestamps).toInstant().toEpochMilli();
}

private Map<String, Object> buildHostAndTimestampInfo(long timestamp, String hostName, String hostAddress) {
Map<String, Object> additionalInfo = new HashMap<>();
additionalInfo.put("@timestamp", timestampInUtc(timestamp));
additionalInfo.put("host", hostName);
additionalInfo.put("hostAddress", hostAddress);
if (additionalMetricAttributes != null && !additionalInfo.isEmpty()) {
additionalInfo.putAll(additionalMetricAttributes);
}
return additionalInfo;
}

Enhance http-test-utils to allow sending of specific headers

ch.squaredesk.nova.comm.http.HttpRequestSender doesn't have any option to pass headers to requests..
please add that additional parameter (Map<> or so) and uset it to set headers for request (connection.setRequestProperty("name", "value"))

Support user defined MIME types

Currently, MIME types are represented as an enum (MediaType) in Nova. This does not allow user to specify new MIME types when using the libs. Since we do not want to release a new version for every MIME type, it should be possible to specify arbitrary ones

RPC requests fail if json payload is longer than 256 characters

We noticed a strange behaviour that may be related with Nova RpcServer->NonBlockingHttpHandler
When making a request from our services, the requests fail if the json string is longer than 256 characters which happens to be READ_CHUNK_SIZE from the above class; it seems that the unmarshalling is triggered before all data is read, thus incomplete json chunks gets to be deserialized (which of course that fails);
please take a look

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.