tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TOMEE-2291) Fault Tolerance Microprofile example for @Retry
Date Wed, 05 Dec 2018 19:04:00 GMT

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

ASF GitHub Bot commented on TOMEE-2291:
---------------------------------------

Github user brunobat commented on a diff in the pull request:

    https://github.com/apache/tomee/pull/240#discussion_r239190370
  
    --- Diff: examples/mp-faulttolerance-retry/src/main/java/org/superbiz/rest/WeatherGateway.java
---
    @@ -0,0 +1,115 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.superbiz.rest;
    +
    +import java.time.Duration;
    +import java.time.Instant;
    +import java.util.concurrent.atomic.AtomicInteger;
    +import java.util.logging.Level;
    +import java.util.logging.Logger;
    +import javax.enterprise.context.RequestScoped;
    +import org.eclipse.microprofile.faulttolerance.Retry;
    +
    +
    +@RequestScoped
    +public class WeatherGateway {
    +
    +    private static Logger LOGGER = Logger.getLogger(WeatherGateway.class.getName());
    +
    +    private static final String FORECAST_TIMEOUT_MESSAGE_ATTEMPTS =
    +            "Timeout when accessing AccuWeather Forecast Service. Max of Attempts: (%d),
Attempts: (%d)";
    +
    +    private static final String FORECAST_TIMEOUT_MESSAGE =
    +            "Timeout when accessing AccuWeather Forecast Service.";
    +
    +    private static final String FORECAST_TIMEOUT_MESSAGE_DELAY =
    +            "Timeout when accessing AccuWeather Forecast Service. Delay before this attempt:
(%d)";
    +
    +    private static final String FORECAST_BUSY_MESSAGE =
    +            "Error AccuWeather Forecast Service is busy. Number of Attempts: (%d) \n";
    +
    +    /**
    +     * {@link Retry#maxRetries()}
    +     */
    +    private static final int DEFAULT_MAX_RETRY = 3;
    +
    +    private AtomicInteger counterStatusOfDay = new AtomicInteger();
    --- End diff --
    
    These AtomicInteger can be set to final


> Fault Tolerance Microprofile example for @Retry
> -----------------------------------------------
>
>                 Key: TOMEE-2291
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2291
>             Project: TomEE
>          Issue Type: Sub-task
>          Components: Examples and Documentation
>    Affects Versions: 8.0.0-M1
>            Reporter: Bruno Baptista
>            Assignee: Jonathan Gallimore
>            Priority: Major
>              Labels: examples, fault-tolerance, microprofile, pull-request-available
>             Fix For: 8.0.0-Final
>
>
> We would like to have an example for MicroProfile (MP) Fault Tolerance (FT) @Retry annotation.
> To get up to speed on the FT MP spec please take a look at these blog posts:
> [https://www.tomitribe.com/blog/microprofile-fault-tolerance-take-2/]
> [https://www.tomitribe.com/blog/microprofile-fault-tolerance-annotations/]
> [https://www.tomitribe.com/blog/tomee-a-tutorial-on-microprofile-fault-tolerance/]
> Example name should be mp-faulttolerance-retry, following the standard already in the
project.
> All the examples are in:
> [https://github.com/apache/tomee/tree/master/examples]
> See this example of @Counted metrics example for reference:
> [https://github.com/apache/tomee/tree/master/examples/mp-metrics-counted]
> And this example:
> [https://github.com/tomitribe/microprofile-samples/tree/master/fault-tolerance/retry]
> The PR has to contain arquillian tests validating the example.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message