Controlling scheduler for endpoint?

Ok. Sounds good. I hear you guys. I just implemented Invoke-UDEndpoint. I had a bit of a revelation that made me realize this is much easier than I originally thought.

Invoke-UDEndpoint -Id <string> [-Session] [-Wait]

You’ll be able to invoke any endpoint, scheduled or otherwise, using Invoke-UDEndpoint. If you want to wait on the result, you can use -Wait. It will then return the result of the execution. If you don’t want to wait, don’t use that and it won’t write anything to the pipeline. -Session will invoke an endpoint in the current users session. If you don’t include that, it will use global endpoints, like scheduled endpoints.

Here’s an example.

$Schedule = New-UDEndpointSchedule -Every 1 -Day 

        $EverySecond = New-UDEndpoint -Schedule $Schedule -Endpoint {
            $Cache:Value = Get-Random
        } -Id 'schedule'

        $Endpoint = New-UDEndpoint -Url "changeSchedule" -Endpoint {
            Invoke-UDEndpoint -Id 'schedule'
        }

        $Endpoint = New-UDEndpoint -Url "test" -Endpoint {
            $Cache:Value
        }

        Start-UDRestApi -Endpoint @($Endpoint, $EverySecond) -Port 10001 -Force

Waiting on tests but it will be in this PR.

I will be removing the Scheduled parameter set for Invoke-UDEvent.

2 Likes

I love it and great work on this too … :+1:

Thank you Adam, am going to test it and let you know if i found and issues.

OMG this is SUPER COOL!, definitely believe this will open up allsorts of new creativeness ;), will update this thread later today.

2 Likes

@adam

Just thinking as i am on my mobile, is this one also possible using the new commands?
Don’t thinks, right?? :slight_smile:

Hey guys, so I would like to leverage such functionality in my current dashboard which is currently running UD2.9ENT, is this currently possible, reason is, I was trying to flex this update with the nighlty builds but that broke too much, then spent few hrs discovering and got errors like:

There was an error with your Endpoint for this page. You need to return at least one component from the Endpoint.

After trying to rebuild some of my tables I got this: #### There was an error rendering component of type mu-table. TypeError: Cannot read property ‘scrollWidth’ of null

silly me I realized this was using v3 codebase, again not sure if its even possible, but would save a ton of work, IMO its totally worth it, but for this protype im supposed to demo, would be awesome feature to have with out the heavy lift to v3.

Not sure what do you guys think?

Yes. You could use New-UDEndpoint + Invoke-UDEndpoint to run a background task as long as you didn’t use the -Wait parameter for Invoke-UDEndpoint.

1 Like

I’ll see what it would take to back port to v2.

1 Like

@adam, would really really appreciate that!

@adam
Thank you adam, that will be great to be able to test the new command.

1 Like