camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Burgazzoli (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-10795) PingCheck API
Date Thu, 09 Feb 2017 13:02:41 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-10795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15858241#comment-15858241
] 

Luca Burgazzoli edited comment on CAMEL-10795 at 2/9/17 1:01 PM:
-----------------------------------------------------------------

A potential API could be:

{code:java}
/** 
 * 
 */
enum ValidationScope {
    // only check connectivity, if make sense for the component
    connectivity,
    // only check parameters correctness
    parameters
}

/**
 *
 */
enum ValidationStatus {
  OK,
  ERROR,    
  // scope not supported, i.e. a component does not have a connection  
  UNSUPPORTED 
}

/**
 * Represent a validation result
 */
class ValidationResult {

    /**
     * @return the status
     */
    ValidationStatus getStatus();

    /** 
     * @return the error codes and their description
     */
    Map<String, String> getErrorDetails();

     /** 
     * @return the errors associated to input
     */
    Map<String, String> getParameterErrors();
}

interface Component {
    /**
     * We can call it twice if we want two validation and make the external service coarse
grained
     *
     * @return a validation result, depending of the scope the method may return one or more
results (i.e. one per wrong parameter)
     */
    ValidationResult validateOptions(ValidationScope scope, Map<String, String> options);
}
{code}



was (Author: lb):

A potential API could be:

{code:java}
/** 
 * 
 */
enum ValidationScope {
    // only check connectivity, if make sense for the component
    connectivity,
    // only check parameters correctness
    parameters
}

/**
 *
 */
enum ValidationStatus {
  OK,
  ERROR,    
  // scope not supported, i.e. a component does not have a connection  
  UNSUPPORTED 
}

/**
 * Represent a validation result
 */
class ValidationResult {

    /**
     * @return the status
     */
    ValidationStatus getStatus();

    /**
     * @return the code
     */
    String getCode();

    /** 
     * @return the error codes and their desc
     */
    Map<String, String> getErrorDetails();

     /** 
     * @return the errors associated to input
     */
    Map<String, String> getParameterErrors();
}

interface Component {
    /**
     * We can call it twice if we want two validation and make the external service coarse
grained
     *
     * @return a validation result, depending of the scope the method may return one or more
results (i.e. one per wrong parameter)
     */
    ValidationResult validateOptions(ValidationScope scope, Map<String, String> options);
}
{code}


> PingCheck API
> -------------
>
>                 Key: CAMEL-10795
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10795
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Claus Ibsen
>             Fix For: 2.19.0
>
>
> Related to CAMEL-10026 about Health Check API
> We need some way for Camel components to be able to more easily validate if they can
connect to their remote system.
> And for that the user must configure the Camel component/endpoint accordingly with details
such as username/password/tokens/ other beans etc.
> How this is done varies from Camel component to component, but most of them uses endpoint
options.
> So we may want to introduce some interface (whether the name Pingable is a good name
is up for discussion)
> {code}
> interface Pingable {
>     PingResult ping(Map<String, String> config);
>     boolean canPing(Map<String, String> config);
> }
> class PingResult {
>  private boolean isSuccess();
>  private String errorMessage();
> }
> {code}
> This API is just a little suggestion.
> The parameters should ideally be type less, eg Map<String, String> as the user
configures this in endpoint uris, XML DSL etc. and therefore we should be able to do this
without having to use Java code per see.
> Also we may want to have canPing as a method to check if the component can accept the
ping or not. In some cases it may not be able to do the ping.
> For example camel-http component would just require the following information in the
Map<String, String>
> httpUri=http://myserver/foo/bar
> Where httpUri is the name of the option accordingly to the table at
> https://github.com/apache/camel/blob/master/components/camel-http/src/main/docs/http-component.adoc
> And then it depends on each Camel component how they do the ping check, the http component
may do a HTTP HEAD or a HTTP GET etc and check the HTTP response code etc.
> Notice this is not intended entirely for runtime health check, but for validating/testing
Camel components can work with the user given configuration to connect to the remote system.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message