0
Completed

Managing the Broker Service restart

Bob Bradley 5 years ago in UNIFYBroker SDK and UNIFYCore updated by Matthew Davis (Technical Product Manager) 5 years ago 1

In troubleshooting SAP connectivity I am repeatedly making changes to the Unify.Service.Connect.exe.config file and restarting Broker - but being careful not to start until the existing process has completely stopped - which usually takes about 30 seconds in my environment.

I got tired of doing this manually and wrote the following simple script - which must be run from an Administrator PS session:

cls

[bool]$isRunning = [bool](Get-Process "Unify.Service.Connect" -ErrorAction SilentlyContinue)

if ($isRunning) {

net stop service.connect

}

[int]$counter = 0

while ($isRunning) {

$counter++

Write-Host "Waiting [$counter] seconds for service to shut down ..."

Start-Sleep 1

$isRunning = [bool](Get-Process "Unify.Service.Connect" -ErrorAction SilentlyContinue)

}

net start service.connect

I hope others find this useful too!

Answer

Answer
Completed

Hey Bob,
Thanks for that script - very helpful.

The other option that you have is using the Unify.Service.Connect.Debug.exe file (and associated config) when you're attempting to develop. The files are identical OOTB, the debug.exe just runs the 'service' as a console app instead of as a service.

The behaviour should be identical, but saves you having to start and stop the service each time you want to make a change. You can simply close the console app, make your changes in the debug.exe.config file, then start it up again and see how it goes. Once you've got your changes working, you can migrate them over to the normal exe.config file for ongoing use. This may make development to that file simpler, but the above script is definitely useful for minor changes.

Answer
Completed

Hey Bob,
Thanks for that script - very helpful.

The other option that you have is using the Unify.Service.Connect.Debug.exe file (and associated config) when you're attempting to develop. The files are identical OOTB, the debug.exe just runs the 'service' as a console app instead of as a service.

The behaviour should be identical, but saves you having to start and stop the service each time you want to make a change. You can simply close the console app, make your changes in the debug.exe.config file, then start it up again and see how it goes. Once you've got your changes working, you can migrate them over to the normal exe.config file for ongoing use. This may make development to that file simpler, but the above script is definitely useful for minor changes.