none
Activating a remote exe through Service Broker External Activator

    Question

  • Hello all,

    I have requirement that a database server can’t have any custom application code, this requirement means that a custom queue processor cannot be installed on the database server where we have a Service Broker queue that is monitored by Service Broker External Activator.

    So I am trying to find a configuration that will allow Service Broker External Activator to launch an exe that resides on another server from the queue that is being monitored. 

    I have tried two different setups of Service Broker External Activator so far.

    The first, where the External Activator is installed on a server where the exe resides and monitors the queue remotely.  In this setup the activation is triggered but it appears External Activator is looking for the exe on the server where the queue is located. So when it can’t find it, the activation fails.

    I have looked at a way of specifying the server as part of the launch exe’s configuration but have failed to find anything.

    The second setup I have tried places the External Activator with the queue it monitors, again there doesn’t appear to be a configuration setting that can specify the exe to launch across a network.

    I have considered routing the monitored queue’s messages to a new installation of SQL Server on the machine where the exe is located and configure External Activator to monitor it but this appears to be an overkill because of the administrative overhead of maintaining the additional SQL Server installation.

    So can Service Broker External Activator launch a remote exe and if not what are the alternatives?

    Any suggestions are welcome,

    Thanks,

    Gurbhajan

    Thursday, December 01, 2011 11:01 AM

Answers

  • Hi,

    EA does support the running on a remote server with the application.exe that is separate from the SQL Server database. This is intended to offload from the SQL Server box the processing workloads or for security reasons.

    I would pursue this avenue and why the application.exe did not launch for you. As far as I know, however the ssbeas.exe must be running on the same server as the application.exe. You might come up with some 3rd party software and .cmd\.bat file to accomplish this but t would not be a default configuration. Below is an example of the configuration that should work.

    Server1
    =====
    sqlservr.exe  (Microsoft SQL Server)

    Server2
    =====
    ssbeas.exe (Microsoft Service Broker External Activator)
    MyMessageReceiver.exe   (application.exe)


    Below is a sample configuration for your review. On Server1 I have Microsoft SQL Server installed with a database named TraderDB. I have a Notification Service and Notification Queue setup. This is the Queue and Service that EA will monitor. I have a SSBTarget Service and SSBTargetQueue that my application will connect to and receive messages out of to process. I'll assume you have the create event notification and permissions set up OK since you did not mention it in your post.

    On Server2, I have the Microsoft Service Broker External Activator (ssbeas.exe) installed along with a C# application that I wrote named MyMessageReceiver.exe. MyMessageReceiver.exe takes four parameters on startup <Server><DatabaseName><Schema><QueueName>. Every three seconds ssbeas.exe will execute a rpc command to receive a message from the NotificationQueue. Below is an example of what you will see in profiler.

    exec sp_executesql N'WAITFOR (RECEIVE conversation_handle,message_type_name,service_contract_name,convert(xml, message_body) FROM [dbo].[NotificationQueue]), TIMEOUT @timeout',N'@timeout int',@timeout=3000

    If the proper message is in the queue then ssbeas.exe will use the LaunchInfo section of the EAService.config to execute MyMessageReceiver.exe.


    <?xml version="1.0" encoding="utf-8"?>
    <Activator xmlns="http://schemas.microsoft.com/sqlserver/2008/10/servicebroker/externalactivator"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://schemas.microsoft.com/sqlserver/2008/10/servicebroker/externalactivator EAServiceConfig.xsd"
               >
      <NotificationServiceList>
        <NotificationService name="NotificationService" id="100" enabled="true">
          <Description>My test notification service</Description>
          <ConnectionString>
            <!-- All connection string parameters except User Id and Password should be specificed here -->
            <Unencrypted>server=Server1;database=TraderDB;Application Name=External Activator;Integrated Security=true;</Unencrypted>
          </ConnectionString>
        </NotificationService>
      </NotificationServiceList>
      <ApplicationServiceList>
        <ApplicationService name="MyMessageReceiver" enabled="true">
          <OnNotification>
            <ServerName>Server1</ServerName>
            <DatabaseName>TraderDB</DatabaseName>
            <SchemaName>dbo</SchemaName>
            <QueueName>SsbTargetQueue</QueueName>
          </OnNotification>
          <LaunchInfo>
            <ImagePath>D:\CASEFILES\SSB\MyMessageReceiver\bin\Release\MyMessageReceiver.exe</ImagePath>
            <CmdLineArgs>Server1 TraderDB DBO SsbTargetQueue</CmdLineArgs>
            <WorkDir>D:\CASEFILES\SSB\MyMessageReceiver\bin\Release</WorkDir>
          </LaunchInfo>
          <Concurrency min="1" max="1" />
        </ApplicationService>
      </ApplicationServiceList>
      <LogSettings>
        <LogFilter>
        </LogFilter>
      </LogSettings>
    </Activator>

     

    To troubleshoot why the application.exe is not launching I would make sure you have a
    <WorkDir> section in your configuration file. I would also review your log file (EATrace.log) for possible clues.

    Thanks,
    Cathy Miller
    Microsoft Online Community Support

    • Proposed as answer by Blakmk Thursday, December 29, 2011 2:15 PM
    • Marked as answer by Gurbhajan Monday, July 09, 2012 12:00 PM
    Monday, December 05, 2011 7:10 PM
    Moderator

All replies

  • Hi Gurbhajan,

    As for this issue, I am trying to involve someone more familiar with this topic for a further look at this issue.  Thanks for your understanding.

    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Stephanie Lv

    TechNet Community Support

    Friday, December 02, 2011 8:50 AM
  • Hi,

    EA does support the running on a remote server with the application.exe that is separate from the SQL Server database. This is intended to offload from the SQL Server box the processing workloads or for security reasons.

    I would pursue this avenue and why the application.exe did not launch for you. As far as I know, however the ssbeas.exe must be running on the same server as the application.exe. You might come up with some 3rd party software and .cmd\.bat file to accomplish this but t would not be a default configuration. Below is an example of the configuration that should work.

    Server1
    =====
    sqlservr.exe  (Microsoft SQL Server)

    Server2
    =====
    ssbeas.exe (Microsoft Service Broker External Activator)
    MyMessageReceiver.exe   (application.exe)


    Below is a sample configuration for your review. On Server1 I have Microsoft SQL Server installed with a database named TraderDB. I have a Notification Service and Notification Queue setup. This is the Queue and Service that EA will monitor. I have a SSBTarget Service and SSBTargetQueue that my application will connect to and receive messages out of to process. I'll assume you have the create event notification and permissions set up OK since you did not mention it in your post.

    On Server2, I have the Microsoft Service Broker External Activator (ssbeas.exe) installed along with a C# application that I wrote named MyMessageReceiver.exe. MyMessageReceiver.exe takes four parameters on startup <Server><DatabaseName><Schema><QueueName>. Every three seconds ssbeas.exe will execute a rpc command to receive a message from the NotificationQueue. Below is an example of what you will see in profiler.

    exec sp_executesql N'WAITFOR (RECEIVE conversation_handle,message_type_name,service_contract_name,convert(xml, message_body) FROM [dbo].[NotificationQueue]), TIMEOUT @timeout',N'@timeout int',@timeout=3000

    If the proper message is in the queue then ssbeas.exe will use the LaunchInfo section of the EAService.config to execute MyMessageReceiver.exe.


    <?xml version="1.0" encoding="utf-8"?>
    <Activator xmlns="http://schemas.microsoft.com/sqlserver/2008/10/servicebroker/externalactivator"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://schemas.microsoft.com/sqlserver/2008/10/servicebroker/externalactivator EAServiceConfig.xsd"
               >
      <NotificationServiceList>
        <NotificationService name="NotificationService" id="100" enabled="true">
          <Description>My test notification service</Description>
          <ConnectionString>
            <!-- All connection string parameters except User Id and Password should be specificed here -->
            <Unencrypted>server=Server1;database=TraderDB;Application Name=External Activator;Integrated Security=true;</Unencrypted>
          </ConnectionString>
        </NotificationService>
      </NotificationServiceList>
      <ApplicationServiceList>
        <ApplicationService name="MyMessageReceiver" enabled="true">
          <OnNotification>
            <ServerName>Server1</ServerName>
            <DatabaseName>TraderDB</DatabaseName>
            <SchemaName>dbo</SchemaName>
            <QueueName>SsbTargetQueue</QueueName>
          </OnNotification>
          <LaunchInfo>
            <ImagePath>D:\CASEFILES\SSB\MyMessageReceiver\bin\Release\MyMessageReceiver.exe</ImagePath>
            <CmdLineArgs>Server1 TraderDB DBO SsbTargetQueue</CmdLineArgs>
            <WorkDir>D:\CASEFILES\SSB\MyMessageReceiver\bin\Release</WorkDir>
          </LaunchInfo>
          <Concurrency min="1" max="1" />
        </ApplicationService>
      </ApplicationServiceList>
      <LogSettings>
        <LogFilter>
        </LogFilter>
      </LogSettings>
    </Activator>

     

    To troubleshoot why the application.exe is not launching I would make sure you have a
    <WorkDir> section in your configuration file. I would also review your log file (EATrace.log) for possible clues.

    Thanks,
    Cathy Miller
    Microsoft Online Community Support

    • Proposed as answer by Blakmk Thursday, December 29, 2011 2:15 PM
    • Marked as answer by Gurbhajan Monday, July 09, 2012 12:00 PM
    Monday, December 05, 2011 7:10 PM
    Moderator
  • Hi Cathy,

    Thanks for the response. If the application.exe can run on a remote server, what approach would be taken for running a farm of remote servers. Is this a candidate for load balancing or is there a more elegant solution?

    mark 

    Thursday, December 29, 2011 2:16 PM