Git Product home page Git Product logo

Comments (6)

mrm9084 avatar mrm9084 commented on July 19, 2024

@JFulfordMS, can you provide more info like which of our packages you are using and what the version info is.

from appconfiguration.

JFulfordMS avatar JFulfordMS commented on July 19, 2024

@JFulfordMS, can you provide more info like which of our packages you are using and what the version info is.

I'm using Azure.Data.AppConfiguration 1.4.1 and AzureAppConfiguration 7.2.0.

from appconfiguration.

zhenlan avatar zhenlan commented on July 19, 2024

@JFulfordMS please follow the document below for using App Configuration in Azure Functions.

from appconfiguration.

jimmyca15 avatar jimmyca15 commented on July 19, 2024

@JFulfordMS

To help me make sure I understand what you're talking about, can you tell/show me how you get the Function to use a schedule defined in App Configuration?

from appconfiguration.

JFulfordMS avatar JFulfordMS commented on July 19, 2024

Sure, here is a way to test it. I set the parameter of "CdataHelper:Schedule" in an app configuration store to "*/30 * * * * *
". Then reference it in the TimerTrigger constructor. The function changes the value of the parameter to "*/5 * * * * *
" and successfully gets the updated value on the next run, but the timer still only runs every 30 seconds.

`

    private readonly IConfiguration _configuration;
    private readonly IConfigurationRefresher _configurationRefresher;
    private readonly ConfigurationClient configurationClient;

    public CdataJobFunctions(IConfiguration configuration, IConfigurationRefresherProvider refresherProvider)
    {
        _configuration = configuration;
        _configurationRefresher = refresherProvider.Refreshers.First();
        configurationClient = new ConfigurationClient(Environment.GetEnvironmentVariable("ConfigConnectionString"));
       
    }
    static HttpClient httpClient = new HttpClient();

    [FunctionName("DoUpdate")]
    public async Task Run([TimerTrigger("%CdataHelper:Schedule%")] TimerInfo myTimer, ILogger log)
    {

        log.LogInformation($"Running at: {DateTime.Now}");

        log.LogInformation(_configuration["CdataHelper:Schedule"]);
      
        var setting = configurationClient.SetConfigurationSetting("CdataHelper:Schedule", "*/5 * * * * *");
        await _configurationRefresher.TryRefreshAsync();

    }

`

[2024-06-03T12:10:30.006Z] Executing 'DoUpdate' (Reason='Timer fired at 2024-06-03T08:10:30.0052795-04:00', Id=84a6331c-e7c1-46f0-8ac5-e872ac43b9cc)
[2024-06-03T12:10:30.008Z] Running at: 6/3/2024 8:10:30 AM
[2024-06-03T12:10:30.008Z] */30 * * * * *
[2024-06-03T12:10:30.595Z] Executed 'DoUpdate' (Succeeded, Id=84a6331c-e7c1-46f0-8ac5-e872ac43b9cc, Duration=590ms)
[2024-06-03T12:11:00.010Z] Executing 'DoUpdate' (Reason='Timer fired at 2024-06-03T08:11:00.0094870-04:00', Id=9015ccad-a249-41f3-b1e1-cdb49d616c2d)
[2024-06-03T12:11:00.014Z] Running at: 6/3/2024 8:11:00 AM
[2024-06-03T12:11:00.015Z] */5 * * * * *
[2024-06-03T12:11:00.178Z] Executed 'DoUpdate' (Succeeded, Id=9015ccad-a249-41f3-b1e1-cdb49d616c2d, Duration=168ms)
[2024-06-03T12:11:30.011Z] Running at: 6/3/2024 8:11:30 AM
[2024-06-03T12:11:30.012Z] */5 * * * * *
[2024-06-03T12:11:30.500Z] Executed 'DoUpdate' (Succeeded, Id=39db3973-6db1-490c-99de-3381840462a1, Duration=491ms)

from appconfiguration.

zhenlan avatar zhenlan commented on July 19, 2024

The trigger uses the app setting binding expression of the Azure Functions. While your code can pick up the latest value in App Configuration, I suspect Azure Functions won't pick up the new setting without the function app being restarted (just like how app setting works in Azure Functions).

from appconfiguration.

Related Issues (20)

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.