was unexpected." SSBEA registers and my application is never called I am running a standard...">

Msgstr "The notification message type <MessageType> was unexpected." SSBEA registers and my application is never called

I am running a standard version of SQL Server 2005 with an external activator installed. I have the following code in the SSMS tab:

-- Begin a conversation and send a request message
DECLARE @InitDlgHandle UNIQUEIDENTIFIER;
DECLARE @RequestMsg NVARCHAR(100);

BEGIN TRANSACTION;
    BEGIN DIALOG @InitDlgHandle
        FROM SERVICE [//abc/XYZ/InitiatorPostService]
        TO SERVICE N'//abc/XYZ/TargetPostService'
        ON CONTRACT [//abc/XYZ/PostContract]
        WITH ENCRYPTION = OFF;

    SELECT @RequestMsg = N'<RequestMsg>Message for Target service.</RequestMsg>';

    SEND ON CONVERSATION @InitDlgHandle
        MESSAGE TYPE [//abc/XYZ/RequestPostMessage](@RequestMsg);

    SELECT @RequestMsg AS SentRequestMsg, @InitDlgHandle AS ConversationHandle;
COMMIT TRANSACTION;
GO

When I run it, I get the expected result in the results pane. An error message appears in EATrace.log "The notification message type // abc / XYZ / RequestPostMessage was unexpected."

-- Create message types
CREATE MESSAGE TYPE [//abc/XYZ/RequestPostMessage]  VALIDATION = WELL_FORMED_XML;
CREATE MESSAGE TYPE [//abc/XYZ/ReplyPostMessage]    VALIDATION = WELL_FORMED_XML;
GO

-- Create contract
CREATE CONTRACT [//abc/XYZ/PostContract]
     ([//abc/XYZ/RequestPostMessage] SENT BY INITIATOR,
     [//abc/XYZ/ReplyPostMessage] SENT BY TARGET
);
GO

-- Create target queue and service
CREATE QUEUE TargetPostQueue WITH RETENTION = ON;
CREATE SERVICE [//abc/XYZ/TargetPostService]
     ON QUEUE TargetPostQueue([//abc/XYZ/PostContract]);
GO

-- Create the initiator queue and service
CREATE QUEUE InitiatorPostQueue WITH RETENTION = ON;
CREATE SERVICE [//abc/XYZ/InitiatorPostService]
     ON QUEUE InitiatorPostQueue([//abc/xyz/PostContract]);
GO

-- Create a notification for External Activator
CREATE QUEUE NotificationPostQueue
CREATE SERVICE [//abc/xyz/NotificationPostService]
    ON QUEUE NotificationPostQueue([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification])
CREATE EVENT NOTIFICATION EventQueueActivation
    ON QUEUE [TargetPostQueue]
    FOR QUEUE_ACTIVATION
    TO SERVICE '//abc/xyz/NotificationPostService', 'current_database';
GO

-- Security
GRANT CONNECT TO [**Company**\**Machine**$]                          -- allow CONNECT to the notification database
GRANT RECEIVE ON TargetPostQueue TO [**Company**\**Machine**$]       -- allow RECEIVE from the service queue
GRANT RECEIVE ON NotificationPostQueue TO [**Company**\**Machine**$] -- allow RECEIVE from the notifcation queue
GRANT REFERENCES ON SCHEMA::dbo TO [**Company**\**Machine**$]        -- allow REFRENCES right on the notification queue schema

-- allow VIEW DEFINITION on the target service
GRANT VIEW DEFINITION ON SERVICE::[//abc/xyz/TargetPostService] TO [**Company**\**Machine**$]

-- allow VIEW DEFINITION on the notification service
GRANT VIEW DEFINITION ON SERVICE::[//abc/xyz/NotificationPostService] TO [**Company**\**Machine**$]
GO

There is nothing in EAService.config that tells EA what types of messages to expect. Why am I getting this error instead of EA running the application specified in its configuration file? Is the contract wrong?

** Recently Added Section: **

At the suggestion of Remus, I added the following:

-- Create a notification for External Activator
CREATE QUEUE NotificationPostQueue

CREATE SERVICE [//abc/xyz/NotificationPostService]
    ON QUEUE NotificationPostQueue([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification])

CREATE EVENT NOTIFICATION EventQueueActivation
    ON QUEUE [TargetPostQueue]
    FOR QUEUE_ACTIVATION
    TO SERVICE '//abc/xyz/NotificationPostService', 'current_database';
GO

NotificationService "//abc/xyz/TargetPostService" "//abc/xyz/NotificationPostService", "ERROR = 31, //abc/xyz/NotificationPostService " EATrace.log . sys.services.

** 31 , , **

Team Broker Team, . , , - . , VS2010, , , . , EA. , ? EAService.config . :

<?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="//abc/xyz/NotificationPostService" 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=**MyServer**\**MyInstance**;database=CompanyRehabManagement;Application Name=External Activator;Integrated Security=true;</Unencrypted>
      </ConnectionString>
    </NotificationService>
  </NotificationServiceList>
  <ApplicationServiceList>
    <ApplicationService name="Company.xyz.EAProcessor" enabled="true">
      <OnNotification>
        <ServerName>**MyServer**\**MyInstance**</ServerName>
        <DatabaseName>**MyDbName**</DatabaseName>
        <SchemaName>dbo</SchemaName>
        <QueueName>TargetPostQueue</QueueName>
      </OnNotification>
      <LaunchInfo>
        <ImagePath>C:\Project\Pathway\Source\Company.xyz\Company.xyz.EAProcessor\bin\Debug\Company.xyz.EAProcessor.exe</ImagePath>
        <CmdLineArgs> %sqlserver% %database% %schema% %queue% </CmdLineArgs>
        <WorkDir>C:\Project\Pathway\Source\Company.xyz\Company.xyz.EAProcessor</WorkDir>
      </LaunchInfo>
      <Concurrency min="1" max="1" />
    </ApplicationService>
  </ApplicationServiceList>
  <LogSettings>
    <LogFilter>
      <TraceFlag>All Levels</TraceFlag>
      <TraceFlag>All Modules</TraceFlag>
      <TraceFlag>All Entities</TraceFlag>
    </LogFilter>
  </LogSettings>
</Activator>

? ? , ? :

conversation_id,                      is_initiator, conversation_handle,                  local_service,                  remote_service,                 service_contract,       state_desc, far_broker_instance,                  security_timestamp,      send_sequence, receive_sequence, end_dialog_sequence, system_sequence
411C6F74-B29F-4C47-A538-1B9C900F49BD, 1,            7E7DD27A-E102-E011-93D2-0004239AA238, //abc/xyz/InitiatorPostService, //abc/xyz/TargetPostService,    //abc/xyz/PostContract, CONVERSING, 083E1179-A1C3-4414-A1A6-67238E3879CE, 1900-01-01 00:00:00.000, 1,             0,                -1,                  0
411C6F74-B29F-4C47-A538-1B9C900F49BD, 0,            817DD27A-E102-E011-93D2-0004239AA238, //abc/xyz/TargetPostService,    //abc/xyz/InitiatorPostService, //abc/xyz/PostContract, CONVERSING, 083E1179-A1C3-4414-A1A6-67238E3879CE, 2010-12-08 16:10:59.260, 0,             1,                -1,                  0
+3
4

" " ( ), "current_database". " " - , , = 'current_database'.

+3

, . , :

CREATE EVENT NOTIFICATION EventQueueActivation
ON QUEUE [TargetPostQueue]
FOR QUEUE_ACTIVATION
TO SERVICE '...','...';

, SSBEA , QUEUE_ACTIVATION. , http://schemas.microsoft.com/SQL/Notifications/PostEventNotification ( ).

, SSBEA TargetPostQueue , , .

+2

ERROR 31, , , , . master db, , , .

.

+1
source

I would like to add that the name of the ApplicationService application in EAConfig should be the same as the TargetService in SQL. Therefore, if your target service is called PostInsertedRecordsService, then the attribute name ApplicationService will also be PostInsertedRecordsService.

+1
source

Source: https://habr.com/ru/post/1778811/


All Articles