Petals SE Camel

Add support of placeholders to configure Java routes

Details

  • Type: Improvement Request Improvement Request
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.1.0
  • Component/s: None
  • Security Level: Public
  • Description:
    Hide

    Add support of placeholders configured at component level to configure the Java routes.

    If the placeholder 'my-placeholder' is defined, it could be used as following in the Java route:

    fromPetals(OBTENIR_SIGNATAIRE).process(new Step("Prepare obtention du signataire du bordereau") {
        @Override
        public void process(final Exchange exchange) throws Exception {
            final ObtenirSignataire body = marshalling.unmarshal(exchange.getIn(), ObtenirSignataire.class);
            ...
            final String myPlaceholder = this.getPlaceHolder("my-placeholder");
            ...
            marshalling.marshal(exchange.getOut(), request);
        }
    }).to(...)

    And if placeholders are reloaded, the route definition based on 'PetalsRouteBuilder' will be notified through the method 'onPlaceHolderValuesReloaded':

    @Override
    public void onPlaceHolderValuesReloaded(final Properties newPlaceholders) {
        super.onPlaceHolderValuesReloaded(newPlaceholders);
        try {
            this.reloadFiles();
        } catch (final IOException e) {
            log.warn("An error occurs !.", e);
        }
    }
    Show
    Add support of placeholders configured at component level to configure the Java routes. If the placeholder 'my-placeholder' is defined, it could be used as following in the Java route:
    fromPetals(OBTENIR_SIGNATAIRE).process(new Step("Prepare obtention du signataire du bordereau") {
        @Override
        public void process(final Exchange exchange) throws Exception {
            final ObtenirSignataire body = marshalling.unmarshal(exchange.getIn(), ObtenirSignataire.class);
            ...
            final String myPlaceholder = this.getPlaceHolder("my-placeholder");
            ...
            marshalling.marshal(exchange.getOut(), request);
        }
    }).to(...)
    And if placeholders are reloaded, the route definition based on 'PetalsRouteBuilder' will be notified through the method 'onPlaceHolderValuesReloaded':
    @Override
    public void onPlaceHolderValuesReloaded(final Properties newPlaceholders) {
        super.onPlaceHolderValuesReloaded(newPlaceholders);
        try {
            this.reloadFiles();
        } catch (final IOException e) {
            log.warn("An error occurs !.", e);
        }
    }
  • Environment:
    -

Activity

Hide
Christophe DENEUX added a comment - Thu, 19 Oct 2017 - 17:46:19 +0200

Support of placeholders added

Show
Christophe DENEUX added a comment - Thu, 19 Oct 2017 - 17:46:19 +0200 Support of placeholders added

People

Dates

  • Created:
    Wed, 18 Oct 2017 - 10:22:55 +0200
    Updated:
    Thu, 19 Oct 2017 - 17:46:19 +0200
    Resolved:
    Thu, 19 Oct 2017 - 17:46:19 +0200