Giter Club home page Giter Club logo

bootique-linkmove's Introduction

build test deploy Maven Central

Bootique is a minimally opinionated java launcher and integration technology. It is intended for building container-less runnable Java applications. With Bootique you can create REST services, webapps, jobs, DB migration tasks, etc. and run them as if they were simple commands. No JavaEE container required! Among other things Bootique is an ideal platform for Java microservices, as it allows you to create a fully-functional app with minimal setup.

Each Bootique app is a collection of modules interacting with each other via dependency injection. This GitHub project provides Bootique core. Bootique team also develops a number of important modules. A full list is available here.

Quick Links

Support

You have two options:

  • Open an issue on GitHub with a label of "help wanted" or "question" (or "bug" if you think you found a bug).
  • Post a question on the Bootique forum.

TL;DR

For the impatient, here is how to get started with Bootique:

  • Declare the official module collection:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.bootique.bom</groupId>
            <artifactId>bootique-bom</artifactId>
            <version>3.0-M4</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency> 
    </dependencies>
</dependencyManagement>
  • Include the modules that you need:
<dependencies>
    <dependency>
        <groupId>io.bootique.jersey</groupId>
        <artifactId>bootique-jersey</artifactId>
    </dependency>
    <dependency>
        <groupId>io.bootique.logback</groupId>
        <artifactId>bootique-logback</artifactId>
    </dependency>
</dependencies>
  • Write your app:
package com.foo;

import io.bootique.Bootique;

public class Application {
    public static void main(String[] args) {
        Bootique
            .app(args)
            .autoLoadModules()
            .exec()
            .exit();
    }
}

It has main() method, so you can run it!

For a more detailed tutorial proceed to this link.

Upgrading

See the "maven-central" badge above for the current production version of bootique-bom. When upgrading, don't forget to check upgrade notes specific to your version.

bootique-linkmove's People

Contributors

aarrsseni avatar andrus avatar atomashpolskiy avatar const1993 avatar elena-bondareva avatar irus avatar stariy95 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootique-linkmove's Issues

RestConnector - connector based on Bootique JAX RS client

LinkMove built-in URIConnector is very limited. Would be nice to use all Bootique JAX-RS client machinery (mapped targets, centralized REST client authentication, etc.) for LinkMove purposes.

So let's create a separate module bootique-linkmove-rest (is there a need for bootique-linkmove-rest-cayenne41 ?) that will allow all that stuff (and will not mess up dependencies for those apps not using REST connectors). The type of the connector (as referenced in the Extractor XMLs) will bebq.rest.

-H does not include "jdbc" connector factory

When I run the app that includes LInkMove with -H, I get the following output:

linkmove:
      #
      # Resolved as 'io.bootique.linkmove.LinkMoveFactory'.
      #

      connectorFactories:
            #
            # Resolved as 'List<io.bootique.linkmove.connector.IConnectorF
            # actoryFactory<? extends
            # com.nhl.link.move.connect.Connector>>'.
            #
            -
                  #
                  # Resolved as 'io.bootique.linkmove.connector.IConnector
                  # FactoryFactory<? extends
                  # com.nhl.link.move.connect.Connector>'.
                  #

                  #
                  # Type option: uri
                  # Resolved as 'io.bootique.linkmove.connector.URIConnect
                  # orFactoryFactory'.
                  #

                  type: 'uri'
                  connectors:
                        #
                        # Resolved as 'Map<String, String>'.
                        #
                        <string>: <string>
      extractorsDir: <string>

Somehow there's only a "uri" factory. Another factory ("jdbc") is not listed. This may be an issue with Bootique help generation engine, or with LM doc annotations.

Upgrade to LinkMove 2.7

Upgrading to LinkMove 2.7. It contains important bug fixes and also switches LM to use DFLib DataFrame internally.

UPGRADE

There are no Bootique-specific steps to upgrade your code, however the new LinkMove has substantial changes, so you need to follow its UPGRDADE notes if your code no longer compiles.

add support for Cayenne 4.1

Create a separate module bootique-linkmove-cayenne41 that will be serving Cayenne 4.1. As 4.1 adoption grows, it is important to make switching to it easy across the stack.

"bootique-linkmove-json" module

Create a Bootique wrapper module bootique-linkmove-json (and bootique-linkmove-json-cayenne41) to help with inclusion of link-move-json. Since link-move-json depends on Jackson, this should simplify version management...

New module structure and support for LM 3.x

Upcoming LinkMove 3.x will be using Cayenne 4.2 and Java 11. Let's integrate it in Bootique. As we do that, we should reorganize the modules in a way similar to Agrest. Module names should be aligned with versions of LinkMove, not Cayenne:

  • bootique-linkmove2* - based on LinkMove 2.x and Cayenne 4.2.
  • bootique-linkmove3* - based on LinkMove 3.x and Cayenne 4.2.

Conflict between source and target DataSources

Since LinkMove source connector for JDBC is based on Cayenne, it can actually conflict with target runtime - a source-initiated transaction is attached to the thread, so target may end up using a Connection from the source in some circumstances. So we need to upgrade Cayenne (probably through transitive dependency from bootique-cayenne ) and ensure that Java8DataSourceConnector sets the explicit stack name.

Upgrade to LM 2.14

To be able to implement Cayenne 4.2 compatibility, we need to upgrade to LM 2.14 that implemented bytecode compatibility layer for Cayenne.

Remove Java8 connector hacks

Will remove Java8DataSourceConnectorFactory and Java8DataSourceConnector. Those are no longer needed with LinkMove 2.0 that fully supports Java 8 Cayenne extensions.

Upgrade to LinkMove 3.0.M4

Let's upgrade to LinkMove 3.0.M4. Its main benefit is the new ConnectorFactory design that will not require Bootique-side YAML configuration of the list of connector factories.

Support classpath: URLs in 'extractorsDir'

Currently LinkMoveFactory.extractorsDir is a String that is treated as a File path by LinkMove. However LM also support ClasspathExtractorModelLoader. So let's change 'extractorsDir' to a FolderResourceFactory, and analyze returned URL, configuring LM for either "file:" or "classpath:" URLs (and throwing on URLs that are of any other kind).

LM runtime is not a singleton causing massive resource leak

Turns out LM runtime is not a singleton. It also happens to instantiate Cayenne ServerRuntime for each DataSourceConnector. Given these two facts, in an app with N LinkMove jobs all sharing the same DB connector, we end up creating N LM runtimes, and N ServerRuntimes, causing a massive leak of memory and threads.

Need to change LM runtime to a singleton.

Upgrade to LinkMove 2.18

There are some useful backwards-compatible changes and bug fixes in the latest series of minor releases of LinkMove (2.16, 2.17, 2.18). Let's upgrade both 3.x and 2.x branches

Upgrade to LM 2.11

We are on 2.9, let's upgrade to 2.11 that has a few minor improvements and its own dependency upgrades.

URIConnectorFactory should declare StreamConnector as its type

Hi @andrus , we've had an issue with this recently. ExtractorFactories in LM expect ConnectorFactories that provide StreamConnectors (via the type-based mapping). So when URIConnectorFactory declares its' connector's type as URIConnector, ExtractorFactories are unable to receive an instance of StreamConnector-providing ConnectorFactory (because it's mapped to a different type).

Long story short, we need to change io.bootique.linkmove.connector.URIConnectorFactoryProvider#getConnectorType to return com.nhl.link.move.connect.StreamConnector.

There's another problem with this design, but I will address it in a separate issue.

LinkMove binary incompatibility with Cayenne 4.1

Per nhl/link-move#168, there's a binary incompatibility between LinkMove and Cayenne 4.1, so bootique-linkmove-cayenne41 throws exceptions like this:

```java
java.lang.NoSuchMethodError: org.apache.cayenne.map.DbEntity.getAttributeMap()Ljava/util/SortedMap;

	at com.nhl.link.move.runtime.targetmodel.DefaultTargetEntity.hasAttributeOrRelationship(DefaultTargetEntity.java:88)
	at com.nhl.link.move.runtime.targetmodel.DefaultTargetEntity.createAttribute(DefaultTargetEntity.java:55)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at com.nhl.link.move.runtime.targetmodel.DefaultTargetEntity.getAttribute(DefaultTargetEntity.java:50)
	at com.nhl.link.move.runtime.task.MapperBuilder.createPathMappers(MapperBuilder.java:145)
	at com.nhl.link.move.runtime.task.MapperBuilder.createMapper(MapperBuilder.java:124)
	at com.nhl.link.move.runtime.task.MapperBuilder.build(MapperBuilder.java:91)
	at com.nhl.link.move.runtime.task.createorupdate.DefaultCreateOrUpdateBuilder.createProcessor(DefaultCreateOrUpdateBuilder

Need to upgrade to Cayenne LM 2.7 where this is fixed.

Make IConnectorFactory injectable

(Affects only link-move3 modules)

Now that LM connector factories do not conflict with each other, we no longer need to list supported factories in configuration. Instead, they can be registered via LinkMoveModuleExtender (so each module defining a factory, can register it with LinkMoveModule without creating any conflicts).

Upgrade Notes

  • linkmove.connectorFactories config key will now be ignored and can be removed from application configuration
  • URIConnectorFactory ("uri" type of "connectorFactories") is removed. If you have a set of preconfigured URLs for it, you should instead add bootique-linkmove3-rest as a dependency and configure named URL "targets" under "jerseyclient". Or you might write your own factory similar to this, and your own configuration outside of the linkmove namespace.

Jakarta version of "bootique-linkmove3-rest"

We need a Jakarta version of linkmove-rest for completeness of our Jakarta switch. This will only be made available for LinkMove 3 modules. The new module name will be "bootique-linkmove3-rest-jakarta"

Upgrade to LinkMove 2.15

LinkMove 2.15 fixes this fairly benign, but annoying issue. So would be great to bring this to Bootique. One potentially invasive change in 2.15 is DFLib upgrade to 0.12 (due to a similar dependency issue).

2.15 release notes:

  • #190 Bootique dependency leaks via BOM import
  • #191 Upgrade to DFLib 0.12

Extractor XML descriptors can't be loaded from .jar files

This issue was noted in comments of #5. I am making it a top-level issue for clarity. The 'extractorsDir' config property is bound to FolderResourceFactory but extractor xml files can't be resolved if they are packaged inside a jar.

Now that nhl/link-move#101 is available, we can make it work. Will require LM 2.4 upgrade when it is available.

Upgrade to LM 2.0

Let's upgrade to LinkMove 2.0 that is Java 8 based and supports Cayenne Java 8 extensions.

Parameterized URLs in RestConnector

LM bundled URIConnector and the first version of RestConnector (#39) only allow working with static URLs. JAX-RS WebTarget on the other hand supports URL parameters, that can be substituted via various resolveTemplate methods. So let's take advantage of that and implement binding of extractor execution parameters to connector URL template.

Here is the API we are going to provide:

jerseyclient:
  targets:
    toextract:
      url: "http://127.0.0.1:8080/r1/{p1}?name={p2}"
LmTask task = ..
 Map<String, Object> params = RestConnector.bindTemplateValues()
                    .value("p1", 897L)
                    .value("p2", "a_Name")
                    .toExtractorParameters();
task.run(params);

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.