SQLServer Service Broker / Notification

Hi all
we would like to use the SQLServer Service Broker to send notifications from a B1-database to another database (not B1). In order to do this we have to define message-types, contracts, queues and services inside the B1-database.
The Service Broker will be triggered by the SBO_SP_TransactionNotification procedure.
Is there someone that can definitely tell us, whether this is allowed (according to the SAP B1 license-agreement) or not and whether this definitions will be wiped out during a B1-Update?.
Kind regards
Max

Im not sure if is this allowed (I think that no), but for me seems it better to trigger this from posttransaction notice sp - when it will be in transaction notification, users will wait for triggering, in posttransaction it will triggered after completed the transaction and user will not wait.

Similar Messages

  • Monitor SQL Server service Broker queue status

    I need to monitor SQL Server service Broker queue status.  If the queue is disabled, send me an email alert.
    Can you let me know what's the best way to accomplish it using SCOM?

    1) create a queue for notification
    2) create a service on notification queue
    3)Create an event notification for broker queue disable. Associate this with the queue that you are monitoring.
    4)Create a procedure that send you and email with this event happens
    Example:
    ---- Notification
    CREATE
    QUEUENotify_queue
    -- Service
    CREATE
    SERVICE[http://queue_Notify]
    ONQUEUENotify_queue([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]);
    --Event 
    CREATE
    EVENTNOTIFICATION[http://queue_Notify_event]
    ONQUEUETarget_queue
    FORBROKER_QUEUE_DISABLED
    TOSERVICE'http://queue_Notify','current
    database';
    GO
    procedure will be something like...
    WAITFOR
    RECEIVETOP(1)
    @RecvReqMsgName=message_type_name,
    @RecvReplyMsg=message_body,
    @RecvReplyDlgHandle=conversation_handle
    FROMNotify_queue),TIMEOUT5000
    IF(@RecvReqMsgName='http://schemas.microsoft.com/SQL/Notifications/EventNotification')
    BEGIN
    DECLARE@cmdNVARCHAR(MAX)
    SET@cmd='dbo.sp_send_dbmail
    @profile_name="Name XYZ",
    @recipients="[email protected]",
    @body="CAST(@RecvReplyMsg as NVARCHAR(MAX)",
    @subject="Queue Disabled Detected";'
    EXEC
    (@cmd)
    END

  • Snapshot isolation in combination with service broker

    Hi all,
    I'm currently using the service broker in combination with snapshot isolation on the database.
    The notification request is executed under read commited isolation. The code looks like this:
    SqlDependency dependency = new SqlDependency(command, null, 0);
    dependency.OnChange += eventHandler;
    using (SqlConnection conn = new SqlConnection(connectionString))
    using (SqlTransaction tran = conn.BeginTransaction(IsolationLevel.ReadCommitted))
    command.Transaction = tran;
    command.ExecuteNonQuery();
    tran.Commit();
    The request is successfully created and works fine at the first glance.
    Now here is my problem:
    I created a notification request that should monitor two objects. The query (executed under read committed) looks something like this:
    SELECT Id, DataVersion FROM dbo.MyObjects WHERE Id = 1 OR Id = 2
    Afterwards I delete both objects in separate nested transactions. Both of them are running under snapshot isolation. It looks something like this:
    using (SqlConnection conn1 = new SqlConnection(connectionString))
    conn1.Open();
    using (SqlTransaction tran1 = connection1.BeginTransaction(IsolationLevel.Snapshot))
    using (SqlConnection conn2 = new SqlConnection(connectionString))
    conn2.Open();
    using (SqlTransaction tran2 = conn2.BeginTransaction(IsolationLevel.Snapshot))
    SqlCommand command2 = conn2.CreateCommand();
    command2.Transaction = tran2;
    command2.CommandText = "DELETE FROM MyObjects WHERE Id = 2";
    command2.ExecuteNonQuery();
    tran2.Commit();
    SqlCommand command1 = conn1.CreateCommand();
    command1.CommandText = "DELETE FROM MyObjects WHERE Id = 1";
    command1.Transaction = tran1;
    command1.ExecuteNonQuery();
    tran1.Commit(); //-> Conflict exception
    A conflict exception is raised during the commit of last transaction. The conflict seems to occur in the table "sys.query_notifcations_xxxxxxxxx". This is the exact message:
    An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
    Additional information: Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'sys.query_notification_45295271' directly or indirectly in database 'MyDatabase' to update, delete,
    or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.
    Is there any restriction for the service broker that prohibits the usage of snapshot isolation.
    Thanks in advance.

    No, the error has nothing to do with Service Broker. Or for that matter, query notifications, which is the feature you are actually using. (Query notifications uses Service Broker, but Service Broker != Query notification.)
    You would get the same error if you had a trigger in MyObjects that tried to update the same row for both deletions. A snapshot transaction gives you a consistent view of the database in a certain point in time. Consider this situation:
    Snapshot transaction A that started at time T update a row R at time T2. Snapshot transaction B starts at time T1 updates the same row at time T3. Had they been regular non-snapshot transaction, transaction B would have been blocked already when it tried
    to read R, but snapshot transactions do not get blocked. But if B would be permitted to update R, the update from transaction A would be lost. Assume that the update is an incremental one, for instance updating cash balance for an account. You can see that
    this is not permittable.
    In your case, the row R happens to be a row in an internal table for query notifications, but it is the application design which is the problem. There is no obvious reason to use snapshot isolation in your example since you are only deleting. And there is
    even less reason to have two transactions and connections for the task.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Log files full of service broker errors, but it works OK

    We have a C# web application that is using SQL dependency to expire cached query data. Although everything is working okay we are seeing a lot of errors being generated particularly in our production environment.
    The first error messages is this:
    Service Broker needs to access the master key in the database 'SubscriberManager'. Error code:32. The master key has to exist and the service master key encryption is required.
    It shows up in both the server event log and the SQL server log files. I believe the actual content of the messages something of a red herring as I have created a database master key.
    I have also tried
    Recreating both the service master key and the database master key.
    Made sure the database owner is sa.
    Made sure the user account has permissions to create services, queues, procedures and subscribe query notifications
    Made sure the broker is enabled
    I have seen other people with similar errors whilst researching the issue but the error code almost always seems to be 25 or 26 not 32. I have been unable to find anything that tells me what these error codes mean so I'm not sure of the significance.
    Also I am seeing a lot of errors like this:
    The query notification dialog on conversation handle '{2FA2445B-1667-E311-943C-02C798B618C6}.' closed due to the following error: '-8490Cannot find the remote service 'SqlQueryNotificationService-7303d251-1eb2-4f3a-9e08-d5d17c28b6cf' because
    it does not exist.'.
    I understand that a certain number of these are normal due to the way that SqlDependency.Stop doesn't clean everything up in the database, but we are seeing thousands of these on one of our production servers.
    What is frustrating as we have been using SQL notifications for several years now without issue so something must have changed in either our application or the server setups to cause this but at this point I have no idea what.
    The applications are .net 4.0 MVC and WCF running on Windows 2012 servers calling SQL 2012 servers also running on Windows 2012.

    Hi Mark,
    1. for your question about possible memory pressure, if the used memory is below the Max Server Memory, then it's OK. If you have not set Max Server Memory, you should at least leave 4GB for your x64 system.
    2. for your original question, I suggest you can check my actions below:
    a. run this statement:
    Select name, is_master_key_encrypted_by_server
    from sys.databases
    Where name =
    'your_database_name'
    if the value of "is_master_key_encrypted_by_server" equals to "0", it means the database does not have a encrypted master key.
    b.if there is no encrypted master key, then the error may be hit by the "begin dialog conversation" statement (you can check your sql profiler trace to check".
    "Service Broker dialog security lets your application use authentication, authorization, or encryption for an individual dialog conversation (or dialog). By default,
    all dialog conversations use dialog security. When you begin a dialog, you can explicitly allow a dialog to proceed without dialog security by including the ENCRYPTION = OFF clause on the BEGIN DIALOG CONVERSATION statement. However, if a remote service binding
    exists for the service that the conversation targets, the dialog uses security even when ENCRYPTION = OFF."
    (http://msdn.microsoft.com/en-us/library/ms166036.aspx)
    Workarounds can be disabling the dialog security (using encryption = off) or create a master key. You can find more information in about URL.

  • SQL Service Broker 2012: the connection was closed by the remote end, or an error occurred while receiving data: '64(The specified network name is no longer available.)'

    Anyone can help with the below issue please? Much appreciated.
    We have about 2k+ messages in sys.transmission_queue
    Telnet to the ports 4022 is working fine.
    Network connectivity has been ruled out.
    The firewalls are OFF.
    We also explicitly provided the permissions to the service account on Server A and Server B to the Service broker end points.
    GRANT
    CONNECT ON
    ENDPOINT <broker> <domain\serviceaccount>
    Currently for troubleshooting purposes, the DR node is also out of the Availability Group, which means that we right now have only one replica the server is now a traditional cluster.
    Important thing to note is when a SQL Server service is restarted, all the messages in the sys.transmission queue is cleared immediately. After about 30-40 minutes, the errors are continued to be seen with the below
    The
    connection was
    closed by the
    remote end,
    or an
    error occurred while
    receiving data:
    '64(The specified network name is no longer available.)'

    We were able to narrow down the issue to an irrelevant IP coming into play during the data transfer. We tried ssbdiagnose runtime and found this error:
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    C:\Windows\system32>SSBDIAGNOSE -E RUNTIME -ID 54F03D35-1A94-48D2-8144-5A9D24B24520 Connect to -S <SourceServer> -d <SourceDB> Connect To -S <DestinationServer> -d <DestinationDB>
    Microsoft SQL Server 11.0.2100.60
    Service Broker Diagnostic Utility
    An internal exception occurred: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
    P  29830                                 Could not find the connection to the SQL Server that
    corresponds to the routing address tcp://XX.XXX.XXX.199:4022. Ensure the tool is connected to this server to allow investigation of runtime events
    The IP that corresponds to routing address is no where configured within the SSB. We are yet unsure why this IP is being referred despite not being configured anywhere. We identified that this IP belongs to one of nodes other SQL Server cluster, which has
    no direct relation to the source server. We failed over that irrelevant SQL Server cluster and made another node active and to our surprise, the data from sys.transmission_queue started flowing. Even today we are able to reproduce the issue, if we bring
    back this node [XX.XXX.XXX.199] as active. Since, its a high business activity period, we are not investigating further until we get an approved downtime to find the root cause of it.
    When we get a approved downtime, we will bring the node [XX.XXX.XXX.199] as active and we will be running Network Monitor, Process Monitor and the SSB Diagnose all in parallel to capture the process/program that is accessing the irrelevant IP.
    Once, we are able to nail down the root cause, I will share more information.

  • Alert: SQL Server Service Broker or Database Mirroring Transport stopped

    Hi Team,
    I got this error message even no one DB configured as mirroring ???
    Alert: SQL Server Service Broker or Database Mirroring Transport stopped Priority: 0 Severity: 2 Resolution state: New
    Alert description: The Database Mirroring protocol transport has stopped listening for connections.

    Can you check the rule. By default the configurations are disabled state that is the reason you are getting the alert.
    If it's not configured properly then you might need to override it
    --Prashanth

  • SSIS Catalog views are not executing from PROC calling from a service broker

    Hi Exprets,
    I have a package deployed on SSISDB (the new concept in MS SQL 2012, SSIS catalogs). I have t-sql code in which i will be able to execute SSIS package in SSISDB with no problems. But if i place the same t-sql code inside of a procedure which will be called
    by a service broker , the code is not executing.
    I am using the following code to execute a package in the SSISDB catalog
    Declare @execution_id bigint
    EXEC [SSISDB].[catalog].[create_execution] @package_name=N'LoadToABC.dtsx',
    @execution_id=@execution_id OUTPUT, @folder_name=N'ABC', @project_name=N'LoadToABC',
    @use32bitruntime=False, @reference_id=Null
    DECLARE @var0 NVARCHAR(200)
    = N'D:\MyData\SampleText20120830100001.txt'
    EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id, @object_type=30,
    @parameter_name=N'strFileName', @parameter_value=@var0
    EXEC [SSISDB].[catalog].[start_execution] @execution_id
    This code executes if run it alone or placed in a regular stored procedure , but not executes if i palce this same code inside of a procedure which is being called/executed by a service broker call like this:
    CREATE QUEUE dbo.SampleQueue
    WITH STATUS=ON, ACTIVATION
    (STATUS = ON, MAX_QUEUE_READERS
    = 1,
    PROCEDURE_NAME = spMessageProcSample,  
    EXECUTE AS OWNER);
    The problem occurs if we call the SSIS catalogs inside a proc which will be calling through a service broker queue.
    I am running all these steps on my local instance of SQL SERVER 2012 in which i am the administrator.
    Please advice where i am doing wrong ?
    Thanks,
    Jyodhu.

    Hi ArthurZ,
    Thanks for reply. What i ment was i tried with all the "EXECUTE AS" options. but no luck.
    Can you please explain step by step if you can ? That would be great help.
    This is the error message from server log.
    Message
    The activated proc '[dbo].[spMessageProcSample]' running on queue 'FileTableDB.dbo.SampleQueue' output the following:  'The server principal "USA\cccsat1nmg" is not able to access the database "SSISDB" under the current security context.'
    I logged in with WIndows authentication (Admin) and i created all the objects including Integration services Catalog.
    Thanks,
    Jyodhu.

  • 2lis_18* service orders/notification

    I need to extract service orders and notification data and Im thinking of useing the 2lis_18* logical cockpit extractors but I cant find any documentation on them.  Can anyone point me in the right direction to find the documentation on these or know of any white papers that covers these extractors as well as business content within BW for service orders/notification
    thanks

    You can search in help.sap.. you will get the relevant information...
    CHk this links...
    http://help.sap.com/saphelp_nw70/helpdata/en/f0/f61c3b83e6236de10000000a11402f/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/a7/fb0d3dbd82f72ce10000000a114084/content.htm

  • Can service broker work between SQL Server 2008 and 2012, ssbdiagnose returned an error !

    Hello, 
    We have a setup of three applications that sends and receive messages using Service Broker.
    One part is on a server, we'll call 'S' have Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64)
    The other part, we'll call 'E' use to have Microsoft SQL Server 2008 (SP3) - 10.0.5512.0 (X64).
    But I am migrating these apps to a new server, we'll call 'C' that has: Microsoft SQL Server 2012 (SP1) - 11.0.3339.0 (X64)
    I have used this command line tool to test it :
    ssbdiagnose -E CONFIGURATION FROM SERVICE "//E/S/CService" -S "ServerC" -d EDatabase TO SERVICE "//S/S/ECService" -S ServerS -d SDatabase ON CONTRACT //E/S/ECContact
    It returned: 
    An internal exception occurred: Cannot read property ServiceBrokerGuid.
    This property is not available on SQL Server 7.0.
    So, I am wondering, is it supposed to work between these two versions ?
    As more info, in the previous setup, it was using certificates but I have changed the Endpoints to use only Windows Authentication.
    Thanks for any advice.
    Claude

    Hello, 
    Many thanks to you and Fanny for looking at my question.
    In fact I was unclear, please let me provide you with more details.
    Maybe the use of "always on" plays a role here...  I will use different names so it might be clearer...
    ServerSoftware2008 server has SoftwareDB database.
    ServerEmployees2008 server has EmployeesDB database.
    Service broker use to work fine between those two above, with certificates.
    The new server comes in, two virtual servers with SQL Server 2012 Enterprise Edition with Always On.
    I call it ServerEmployeesC but this is the listener.  Behind, there is ServerEmployees2012_A and ServerEmployees2012_B and of course, both have a EmployeesDB database.
    So, to use SSBDiagnose, I wonder if I need to use quotes around values and if I can use the listener name with FQDN.  Concerning the use of instance name in the syntax, there is only one instance per server, is it best practice to use it on the command
    line ?
    Here is again, my command :
    ssbdiagnose -E CONFIGURATION FROM SERVICE "//E/S/E" -S "ServerEmployeesC.sub.acme.com" -d EmployeesDB TO SERVICE "//S/S/E" -S "ServerSoftware2008.sub.acme.com" -d SoftwareDB ON CONTRACT //E/S/E
    Again, many thanks for any help you will be able to provide, the people who configured this application at first are no longer here and I am trying to configure the new server in a task of migrating to SQL Server 2012 for one of the two servers involved
    and I am having a lot of problems doing it.
    Best regards,
    Claude

  • Configuring Service Broker between SQL Server 2008 and 2012 on Intranet

    Hello, I would need help in configuring Service broker. As both servers are on the intranet, I wanted to remain the most simple so I used no certificates and allowed anonymous access but still, using SSBDiagnose, I can see errors.
    I would like to paste here my configuration and my usage of SSBDiagnose, I already asked a question about SSBDiagnose usage but this new question is rather on the usage of certificates and the configuration of SSB, for me to know if I am doing this in the
    best possible way.
    Reading on the web, I have read in few places that certificates are not mandatory and that Windows Authentication only can be used. Then, I read that even if endpoints don't request certificates, the communication between two servers will still requires
    certificates so I am wondering where is the truth... 
    I have two servers:
    EmployeesSvr (SQL Server 2012 Enterprise Edition with Always On, EmployeesSvr is the listener name in front of two virtual servers)
    CREATE MESSAGE TYPE [//E/S/ETChanged] VALIDATION = WELL_FORMED_XML
    CREATE CONTRACT [//E/S/ECContract] ([//E/S/ETChanged] SENT BY INITIATOR)
    CREATE QUEUE [dbo].[ECQueue] WITH STATUS = ON , RETENTION = OFF , ACTIVATION ( STATUS = ON , PROCEDURE_NAME = [dbo].[SSB_ECQueueProc] , MAX_QUEUE_READERS = 1 , EXECUTE AS N'dbo' )
    CREATE SERVICE [//E/S/ECService] ON QUEUE [dbo].[ECQueue] ([//E/S/ECContract])
    CREATE ROUTE [RouteToSECService] WITH SERVICE_NAME = N'//S/S/ECService' , BROKER_INSTANCE = N'F...' , ADDRESS = N'TCP://SoftwaresSrv.test.com:4022'
    CREATE REMOTE SERVICE BINDING [SECServiceBinding] TO SERVICE N'//S/S/ECService' WITH USER = [domain\SvcBrokerTestUser] , ANONYMOUS = ON
    CREATE ENDPOINT [ESBEndpoint] STATE=STARTED AS TCP (LISTENER_PORT = 4022, LISTENER_IP = ALL) FOR SERVICE_BROKER (MESSAGE_FORWARDING = DISABLED, MESSAGE_FORWARD_SIZE = 10, AUTHENTICATION = WINDOWS NEGOTIATE, ENCRYPTION = DISABLED)
    SoftwaresSvr (SQL Server 2008 R2)
    CREATE MESSAGE TYPE [//E/S/ETChanged] VALIDATION = WELL_FORMED_XML
    CREATE CONTRACT [//E/S/ECContract] ([//E/S/ETChanged] SENT BY INITIATOR)
    CREATE QUEUE [dbo].[ECQueue] WITH STATUS = ON , RETENTION = OFF , ACTIVATION ( STATUS = ON , PROCEDURE_NAME = [dbo].[SSB_ECQueueProc] , MAX_QUEUE_READERS = 1 , EXECUTE AS N'dbo' )
    CREATE SERVICE [//S/S/ECService] ON QUEUE [dbo].[ECQueue] ([//E/S/ECContract])
    CREATE ROUTE [RouteToECService] WITH SERVICE_NAME = N'//E/S/ECService' , BROKER_INSTANCE = N'2...' , ADDRESS = N'TCP://EmployeesSvr.test.com:4022'
    CREATE REMOTE SERVICE BINDING [EECServiceBinding] TO SERVICE N'//E/S/ECService' WITH USER = [domain\SvcBrokerTestUser] , ANONYMOUS = ON
    CREATE ENDPOINT [SSBEndpoint] STATE=STARTED AS TCP (LISTENER_PORT = 4022, LISTENER_IP = ALL) FOR SERVICE_BROKER (MESSAGE_FORWARDING = DISABLED, MESSAGE_FORWARD_SIZE = 10, AUTHENTICATION = WINDOWS NEGOTIATE, ENCRYPTION = DISABLED)
    My SSBDiagnose command :
    ssbdiagnose -E CONFIGURATION
    FROM SERVICE //E/S/ECService
    -S EmployersSvr
    -d EmployersDB
    TO SERVICE //S/S/ECService
    -S SoftwaresSvr
    -d SoftwaresDB
    ON CONTRACT //E/S/ECContract
    The result :
    Microsoft SQL Server 10.50.1600.1
    Service Broker Diagnostic Utility
    D 29978 EmployersSvr EmployersDB
    No valid certificate was found for user domain\SvcBrokerTestUser
    D 29977 SoftwaresSvr SoftwaresDB
    The user domain\SvcBrokerTestUser from database EmployersDB on EmployersSvr cannot be mapped into this database using certificates
    D 29933 SoftwaresSvr SoftwaresDB
    The routing address TCP://EmployeesSvr.test.com:4022 for service //E/S/ECService does not match any of the IP addresses for EmployersSvr
    An internal exception occurred: An exception occurred while executing a Transact-SQL statement or batch.
    Thank you for any help, I am searching for several answers :
    Can I use the setup as I defined, with no certificate ?  Is it risky ?
    Is there too many objects defined ?  Is it mandatory to have a Route and a Remote Service Binding ?  I don't understand how those two are working togheter...
    Is it ok to use the same windows account on each side, do they only need an 'Open' access rigth or do they need to be db_owner ?
    Best regards,
    Claude

    Hi Claude,
    1.Can I use the setup as I defined, with no certificate ?  Is it risky ?
    Service broker does not have to use certificate. The Certificate is necessary when you want to use dialog security, by which you can encrypt all messages sent outside a SQL Server instance.
    http://technet.microsoft.com/en-us/library/ms166036(v=SQL.105).aspx
    2.Is there too many objects defined ?  Is it mandatory to have a Route and a Remote Service Binding ?
    Remote Service Binding is used to privde dialog security. If you donnot need the dialog security, the Remote Service Binding is not mandatory.
    http://technet.microsoft.com/en-us/library/ms166042(v=SQL.105).aspx
    By default, each database contains a route that specifies that messages for any service which does not have an explicit route are delivered within the SQL Server instance. Since you have communications between different instances, creating a route between
    them is necessary.
    http://technet.microsoft.com/en-us/library/ms166032(v=SQL.105).aspx
    3.Is it ok to use the same windows account on each side, do they only need an 'Open' access rigth or do they need to be db_owner ?
    The windows account must own the certificate used for authentication. You can find more information below.
    http://technet.microsoft.com/en-us/library/ms166045(v=SQL.105).aspx
    http://technet.microsoft.com/en-us/library/ms186278(v=sql.105).aspx
    Best regards,

  • SQL server service broker

    Hi All,
    I have requirement to implement SQL server service broker in SQL server 2008, please guide me for that, how and why we use for that, then have any other option to achieve. 
    Please give any good stuff to learn service broker.
    Thanks,
    Jai.

    This is a very good book to learn about Service Broker:
    http://www.amazon.com/Rational-Server-Service-Broker-Guides/dp/1932577270/ref=sr_1_1?ie=UTF8&qid=1418942042&sr=8-1&keywords=%22roger+wolter%22+%22service+broker%22&pebp=1418942044114
    In difference from many other computer books, this is not a brick, but only 220 pages.
    Also, Remus Rusanu's blog covers many important concepts with Service Broker:
    http://rusanu.com/?s=service+broker
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Behaviour of Service Broker during clustered SQL Server failover

    Hi, 
    I have 3 instances of SQL Server 2005 hosted on a 3-node cluster, using Polyserve clustering.  Each instance is nominally hosted on its own node in the cluster.
    I have configured Service Broker to route messages from INST-A (on NODE-1) to INST-C (on NODE-3), using TCP and a NetBIOS name.  This NetBIOS name obviously uses the machine name of the node, rather than the virtual machine name of the instance.
    Under normal conditions, this works, messages sent from INST-A to INST-C are received and processed.
    However, should INST-C failover (for example to NODE-1), the route created to INST-C from INST-A is no longer valid; INST-C is now on a different node to that specified in the route.
    Service Broker stops, unable to put messages onto the queue on INST-C, so backing them up in sys.transmission_queue on INST-A.  To fix, I have to update the route as appropriate.
    We have thousands of messages being sent every minute.  While a delay in sending them during an actual failover is expected, would it not also be expected to recover itself and process any backlog without manual intervention?
    Is there something I'm missing in my configuration?  Or do I need to set up some other means to automatically update the route upon failover?  In which case, how can I programmatically determine the node to which it has failed-over?
    Configuration scripts:
    Target Endpoint:
    CREATE ENDPOINT ServiceBrokerTargetEndpoint
    STATE = STARTED
    AS TCP(LISTENER_PORT = xxxx)
    FOR SERVICE_BROKER(AUTHENTICATION = WINDOWS, ENCRYPTION = REQUIRED)
    CREATE ROUTE RouteToTargetService
    WITH SERVICE_NAME = 'ServiceBrokerTargetService', ADDRESS = 'TCP://INST-C:xxxx'
    INST-A and INST-C are both SQL 2005 Enterprise edition.
    Thanks for any assistance.
    Simon

    Hi David, 
    Thanks for correctly guessing our longer term plans.  It's good to know this won't be a problem in the future.
    However, that doesn't answer my original question, which is a bit more pressing than waiting until we have migrated.  If it can't be done, it can't be done, and we'll just bear that in mind when responding to failover events.  But I would prefer
    a definitive "no, it can't" rather than a speculative "no".  
    Regards, 
    Simon

  • SQL Server Service Broker Updating Stored procedure

    how can you update the service broker stored procedure. when i update the stored procedure the changes dont come into affect. i have tried to alter the queue, waited for all jobs to finish, but some how still the old stored procedure is running. is there any
    way i can force changes to the stored procedure.
    i have tried sql profiler tracing but that didnt show any changes.
    I cannot alter the service broker stored procedure, when I update the stored procedure it does not show any error and successfully gets updated but the changes does not come into affect.
    Is it because I need to stop the queue of the service broker on both databases before the changes could come into affect?
    Note: the service broker stored procedures produce and read xmls.

    Presumably, this is because the procedure is executing when you alter the procedure. And if the procedure never exits, the old code will keep on running. One way to address this is to have the procedure to return if a new message has not been picked up in,
    say, 1000 milliseconds.
    Here is a repro to shows what I'm talking about.
    ------------------------------- Service Broker Objects ------------------------------------------
    CREATE MESSAGE TYPE OrderRequest VALIDATION = NONE
    CREATE MESSAGE TYPE OrderResponse VALIDATION = NONE
    go
    CREATE CONTRACT OrderContract
       (OrderRequest SENT BY INITIATOR,
        OrderResponse SENT BY TARGET)
    go
    CREATE QUEUE OrderRequests WITH STATUS = OFF
    CREATE QUEUE OrderResponses WITH STATUS = ON
    go
    CREATE SERVICE OrderRequests ON QUEUE OrderRequests (OrderContract)
    CREATE SERVICE OrderResponses ON QUEUE OrderResponses (OrderContract)
    go
    -- Procedure to send a message and receive a response.
    CREATE PROCEDURE send_and_get_answer AS
    DECLARE @handle uniqueidentifier,
             @binary varbinary(MAX)
          SELECT @binary = CAST (N'Kilroy was here' AS varbinary(MAX))
          BEGIN DIALOG CONVERSATION @handle
          FROM  SERVICE OrderResponses
          TO    SERVICE 'OrderRequests'
          ON    CONTRACT OrderContract
          WITH ENCRYPTION = OFF
          ;SEND ON CONVERSATION @handle
          MESSAGE TYPE OrderRequest (@binary)
       WAITFOR (RECEIVE TOP (1)
                         @handle = conversation_handle,
                         @binary = message_body
                FROM    OrderResponses)
       SELECT cast(@binary AS nvarchar(MAX)) AS response
       END CONVERSATION @handle
    go
    -- Procedure to process a message
    CREATE PROCEDURE ProcessOrders AS
    SET NOCOUNT, XACT_ABORT ON
    DECLARE @DialogHandle  uniqueidentifier,
            @MessageType   sysname,
            @binarydata    varbinary(MAX)
    -- Get next message of the queue.
    WAITFOR (
       RECEIVE TOP (1) @DialogHandle = conversation_handle,
                         @MessageType  = message_type_name,
                         @binarydata   = message_body
       FROM    OrderRequests
    SELECT @binarydata = CAST( reverse( CAST( @binarydata AS nvarchar(MAX) )) AS varbinary(MAX))
    ; SEND ON CONVERSATION @DialogHandle
    MESSAGE TYPE OrderResponse (@binarydata)
    END CONVERSATION @DialogHandle
    go       
    -- Make this an activaton procedure.
    ALTER QUEUE OrderRequests WITH
          STATUS = ON,
          ACTIVATION (STATUS = ON,
                      PROCEDURE_NAME = ProcessOrders,
                      MAX_QUEUE_READERS = 1,
                      EXECUTE AS OWNER)
    go
    -------------------------------- Send a message  -------------------------------------------
    EXEC send_and_get_answer
    go
    ------------------------ Change the procedure --------------------------------
    ALTER PROCEDURE ProcessOrders AS
    SET NOCOUNT, XACT_ABORT ON
    DECLARE @DialogHandle  uniqueidentifier,
            @MessageType   sysname,
            @binarydata    varbinary(MAX)
    -- Get next message of the queue.
    WAITFOR (
       RECEIVE TOP (1) @DialogHandle = conversation_handle,
                         @MessageType  = message_type_name,
                         @binarydata   = message_body
       FROM    OrderRequests
    SELECT @binarydata = CAST( upper( CAST( @binarydata AS nvarchar(MAX) )) AS varbinary(MAX))
    ; SEND ON CONVERSATION @DialogHandle
    MESSAGE TYPE OrderResponse (@binarydata)
    END CONVERSATION @DialogHandle
    go
    -------------------------------- Send new message -------------------------------------------
    EXEC send_and_get_answer    -- Still produces a message in reverse.
    EXEC send_and_get_answer    -- Now we get the expected result.
    go
    DROP SERVICE OrderRequests
    DROP SERVICE OrderResponses
    DROP QUEUE OrderRequests
    DROP QUEUE OrderResponses
    DROP PROCEDURE ProcessOrders
    DROP PROCEDURE send_and_get_answer
    DROP CONTRACT OrderContract
    DROP MESSAGE TYPE OrderRequest
    DROP MESSAGE TYPE OrderResponse
    go
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Best Possible Approach : Service Broker or replication?

    I have a business scenario. I have an application whose DB resides on SQL Server A. My application resides on SQL server B. Both SQL servers are on the same network. Server A has a table that is being constantly updated via a web application. We want that
    table to be on Server B. At present it is updated nightly from Server A to Server B.
    We want the changes to be replicated to server B in almost real time. 30 minutes delay could work.
    Now considering this business case what would eb my best options:
    1. Implement CDC on server A for the interested table ( Please note that CDC is only for 1 table, I'm not sure if this is possible) . Bring the table from Server A once to Server B using a Linked Server. Then use the CDC from server A to Merge and Update
    on table on Server b using a SP and Schedule this SP after 30 minutes.
    OR
    2. Use CDC and Service combination.
    OR
    3. use Replication.
    OR  ...???
    Any help will greatly be appreciated.

    Snapshot Replication is OK solution here.  You would need to set the snapshot period to 30 min or less. If you want changes to get populated immediately use transactional replication. Service Broker is the best approach since you wouldn't
    have to maintain infrastructures associated with establishing replication facility. But use of Service Broker will require some expertise. Also take a look at this product called SnipeDB framework SnipeDB.com SnipeDB framework would not replicate the
    table, but would allow any subscriber application to get an update on any change in your data.

  • How to use Service Broker, where and when we gonna use it.

    Hi all,
    I have task to implement SQL service broker for some insert statement, am bit confused where i start and how to implement like it may in Database or Server side(ASP.Net- c#), some where.
    What the main advantage of using SQL Service broker?
    Thanks,
    Jai.

    There is more than one place where Service Broker fits in. Generally, one can say that Service Broker permits you to implement things asynchronously. For instance, when a row is updated in a table a mail should be sent to someone. Rather than having a trigger
    that sends the mail on the spot, the trigger could post a message on a Service Broker queue. Then there could be an activation procedure which reacts to this message and composes and sends the mail. This activation can be in the same database - but it can
    also be on a completely different server which does not even have a direct connection to the actual server.
    Activation can also be external. That is, there is an application that polls the queue, and again this could be on an other server, and when there is a message in the queue the application processes it.
    Roger Wolter's book is an excellent introduction to Service Broker:
    http://www.amazon.com/Rational-Server-Service-Broker-Guides/dp/1932577270/ref=sr_1_1?ie=UTF8&qid=1420025225&sr=8-1&keywords=Roger+Wolter+service+broker
    Also, don't overlook Remus Rusanu's blog, which is an excellent resource for development patterns with Service Broker:
    http://rusanu.com/?s=service+broker
    Both Roger and Remus worked on the development of Service Broker, so they know what they are talking about.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Apple Mobile Service must be started to recognize I-Phone?

    Just downloaded I-Tunes latest version for Windows. I took over my wifes I-Phone 3 and in USB connecting get "This I-phone cannot be used because Apple Mobile Device Service has not been started?" How do I fix this?

  • [SOLVED] Access media from both Windows and Arch?

    I'm hoping to get a new laptop around summer time, allowing me to sort any niggles out before I start uni in september. I've been using Arch Linux for a while, and really like it now - it totally stopped by habit of distro-hopping anyway However, I'm

  • Customer/Item/Volume Discount in Basic Pricing

    Client has a case wherein customer gets a special discount when they order more than a certain volume of a particular item. Do we need to set up a Pricing Agreement as Discount Modifier in Basic Pricing doesn't have option to put in a condition/quali

  • Temporary Pop Up Message

    I'm running a Java applet. I need to pop up some kind of message dialog to the user that lets them know that the program is running (while it appears to be doing nothing). However, I don't want this to stop the subsequent lines of the program executi

  • Documentation on CRM billing integrated with R3

    Hi gurus, anybody has documentation (functional could be fine) on CRM billing integrated with R3 FI-AR/AP? It's very urgent Awards for any documentation provided. Bye C