Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234»»

An Introduction to the Service Broker Expand / Collapse
Author
Message
Posted Sunday, June 18, 2006 5:21 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, June 27, 2014 6:27 AM
Points: 22, Visits: 80

I couldn't get any result too.

Anyway, thanks for sharing your exp.

Patrick

Post #288398
Posted Friday, July 14, 2006 8:38 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, October 25, 2010 3:50 PM
Points: 6, Visits: 24

I was not getting any results either in a new database until I ran this script to enable the serice broker in my database:

ALTER DATABASE [DatabaseNameHere] SET ENABLE_BROKER

from 2005 books online:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/ac7e4c7c-e52f-4883-8f3c-9336cc77a9c8.htm

hope that helps....

Post #294487
Posted Friday, July 14, 2006 8:59 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, April 16, 2012 7:08 AM
Points: 3, Visits: 124
It is enabled in my database, and still nothing.


Post #294500
Posted Tuesday, July 25, 2006 10:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, October 25, 2010 3:50 PM
Points: 6, Visits: 24

Here are the steps that worked (finally) for me:

  1. Login as 'sa' on your local sql 2005 server.
  2. Create a new database
  3. In a new query window, run this script: ALTER DATABASE [DatabaseNameHere] SET ENABLE_BROKER (should return: Command(s) completed successfully.)
  4. Copy and paste script from 'Intro...to Service Broker' article into a new query window.
  5. Make sure you're in the newly created database and comment out 'USE AdentureWorks' line at the top.
  6. Add this snippet (from a previous post) ... WITH ENCRYPTION=OFF, LIFETIME= 600; to the end of line #37. (the section that starts with BEGIN DIALOG @conversationHandle ....ON CONTRACT HelloContract [here])
  7. Run entire script on your newly created database and it should return the 'Hello world' message.

If not, do a select * from sys.transmission_queue to see what errors were generated.

Hope that helps....

Post #297167
Posted Wednesday, August 23, 2006 11:11 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, October 31, 2014 8:35 AM
Points: 95, Visits: 578

I finally got this to work.  How do I get rid of messages in sys.transmission_queue? 

Post #303584
Posted Friday, December 14, 2007 2:04 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, January 2, 2014 7:30 AM
Points: 37, Visits: 220
Great article, but something went wrong when I ran the sample code - it returns an empty message.

??

BR

Peter Pirker
Post #433189
Posted Friday, February 1, 2008 6:11 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 29, 2010 12:34 AM
Points: 4, Visits: 16
Hi Srinivas...this was an excellent pice of code... can I pls. have your mail id?? I've some further queries to be clarified..my mail ids are : kbagchi@careindia.org & kingshukbagchi@rediffmail.com .

Thnaks is advance,

Kingshuk.
Post #450425
Posted Tuesday, November 18, 2008 12:56 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, November 20, 2014 10:24 AM
Points: 1,865, Visits: 3,620

Here are the steps that worked (finally) for me:

Login as 'sa' on your local sql 2005 server.
Create a new database
In a new query window, run this script: ALTER DATABASE [DatabaseNameHere] SET ENABLE_BROKER (should return: Command(s) completed successfully.)
Copy and paste script from 'Intro...to Service Broker' article into a new query window.
Make sure you're in the newly created database and comment out 'USE AdentureWorks' line at the top.
Add this snippet (from a previous post) ... WITH ENCRYPTION=OFF, LIFETIME= 600; to the end of line #37. (the section that starts with BEGIN DIALOG @conversationHandle ....ON CONTRACT HelloContract [here])
Run entire script on your newly created database and it should return the 'Hello world' message.
If not, do a select * from sys.transmission_queue to see what errors were generated.

Hope that helps....


I ran the following:


ALTER DATABASE AdventureWorks SET ENABLE_BROKER


Then, after running the following, I still get no results:



-- We will use adventure works as the sample database
USE AdventureWorks
GO
-- First, we need to create a message type. Note that our message type is
-- very simple and allowed any type of content
CREATE MESSAGE TYPE HelloMessage
VALIDATION = NONE
GO
-- Once the message type has been created, we need to create a contract
-- that specifies who can send what types of messages
CREATE CONTRACT HelloContract
(HelloMessage SENT BY INITIATOR)
GO
-- The communication is between two endpoints. Thus, we need two queues to
-- hold messages
CREATE QUEUE SenderQueue

CREATE QUEUE ReceiverQueue
GO
-- Create the required services and bind them to be above created queues
CREATE SERVICE Sender
ON QUEUE SenderQueue

CREATE SERVICE Receiver
ON QUEUE ReceiverQueue (HelloContract)
GO
-- At this point, we can begin the conversation between the two services by
-- sending messages
DECLARE @conversationHandle UNIQUEIDENTIFIER
DECLARE @message NVARCHAR(100)

BEGIN
BEGIN TRANSACTION;
BEGIN DIALOG @conversationHandle
FROM SERVICE Sender
TO SERVICE 'Receiver'
ON CONTRACT HelloContract
WITH ENCRYPTION=OFF, LIFETIME= 600;
-- Send a message on the conversation
SET @message = N'Hello, World';
SEND ON CONVERSATION @conversationHandle
MESSAGE TYPE HelloMessage (@message)
COMMIT TRANSACTION
END
GO
-- Receive a message from the queue
RECEIVE CONVERT(NVARCHAR(max), message_body) AS message
FROM ReceiverQueue;
-- Cleanup
DROP SERVICE Sender
DROP SERVICE Receiver
DROP QUEUE SenderQueue
DROP QUEUE ReceiverQueue
DROP CONTRACT HelloContract
DROP MESSAGE TYPE HelloMessage
GO


__________________________________________________________________________________

Turbocharge Your Database Maintenance With Service Broker: Part 2
Turbocharge Your Database Maintenance With Service Broker: Part 1
Real-Time Tracking of Tempdb Utilization Through Reporting Services
Monitoring Database Blocking Through SCOM 2007 Custom Rules and Alerts
Preparing for the Unthinkable - a Disaster/Recovery Implementation
Post #604669
Posted Tuesday, November 18, 2008 12:59 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, November 20, 2014 10:24 AM
Points: 1,865, Visits: 3,620
Here are the steps that worked (finally) for me:

Login as 'sa' on your local sql 2005 server.
Create a new database
In a new query window, run this script: ALTER DATABASE [DatabaseNameHere] SET ENABLE_BROKER (should return: Command(s) completed successfully.)
Copy and paste script from 'Intro...to Service Broker' article into a new query window.
Make sure you're in the newly created database and comment out 'USE AdentureWorks' line at the top.
Add this snippet (from a previous post) ... WITH ENCRYPTION=OFF, LIFETIME= 600; to the end of line #37. (the section that starts with BEGIN DIALOG @conversationHandle ....ON CONTRACT HelloContract [here])
Run entire script on your newly created database and it should return the 'Hello world' message.
If not, do a select * from sys.transmission_queue to see what errors were generated.

Hope that helps....




Thanks, it does work on a new db, but why does it not work on AdventureWorks, even after enabling the Service Broker??


__________________________________________________________________________________

Turbocharge Your Database Maintenance With Service Broker: Part 2
Turbocharge Your Database Maintenance With Service Broker: Part 1
Real-Time Tracking of Tempdb Utilization Through Reporting Services
Monitoring Database Blocking Through SCOM 2007 Custom Rules and Alerts
Preparing for the Unthinkable - a Disaster/Recovery Implementation
Post #604670
Posted Wednesday, November 19, 2008 9:59 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 29, 2010 12:34 AM
Points: 4, Visits: 16
This has actually worked for me... have you done "alter database [database name] set enable_broker"?

Kingshuk
Post #605568
« Prev Topic | Next Topic »

Add to briefcase «««1234»»

Permissions Expand / Collapse