Need Help with Service Broker

  • Hi Experts,

    Requirement: I have 2 databases in same server.

    Database1: SourceDB and Table: dbo.queue_table

    Database2: TargetDB and Table: dbo.queue_table

    For every entry in SourceDB.dbo.queue_table I have to move the inserted records into TargetDB.dbo.queue_table. Both the tables are having same structure.

    I have created message_types, queue, contract and service and triggers and required procedures on both dbs. but my scripts are not working as expected ..

    Please find the attached script and do the needful.

  • Posisbly a dumb question, but are you enabling the broker? I don't see that in your scripts.

    The other thing I'd recommend is to try sending a message outside of the trigger and watch what happens in the extended events (or profiler).

    You also likely want to enable activation on the service broker queues and give it a procedure name to execute when a message enters the queue.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply