Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Service Broker / June 2006

Tip: Looking for answers? Try searching our database.

Some questions on Service Broker settings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex Petrovsky - 05 Jun 2006 14:52 GMT
Hello,

I have some questions on Service Broker settings:

1) Could you clarify the following settings for creating conversation
between two local databases?

In order to create such conversation you prescribe to set the TRUSTWORTHY
option to ON or to have certificates.

Actually, these settings are not required for creating conversation between
two remote databases.

What is the difference between these two cases?

2) Why do not these settings (TRUSTWORTHY option to ON or to have
certificates) are not required for Event Notification for to local
databases?

As I understand, Event Notification is similar to create conversation
action.

3) We have a problem with Event Notification for two remote databases - sent
messages stay at the transmission queue.

Could you possibly clarify the problem.

For example, I create the following Service Broker objects for Event
Notification.

Then I execute a notification action.

/*Run this script on the server #1*/

USE DB_2

CREATE QUEUE [dbo].[Quest_Event_Notification_Queue_w2k3-7_DB_2_1] WITH
STATUS = ON, RETENTION = OFF ON [DEFAULT]

/*Run this script on the server #1*/

USE DB_2

CREATE SERVICE [Quest_Event_Notification_Service_w2k3-7_DB_2_1]
AUTHORIZATION [dbo] ON QUEUE
[dbo].[Quest_Event_Notification_Queue_w2k3-7_DB_2_1] (
[http://schemas.microsoft.com/SQL/Notifications/PostEventNotification] )

/*Run this script on the server #2*/

USE DB_1

GRANT RECEIVE ON [dbo].[EventNotificationErrorsQueue] TO [dbo]

GRANT SEND ON
SERVICE::[http://schemas.microsoft.com/SQL/Notifications/EventNotificationService]
TO [public]

/*Run this script on the server #1*/

USE DB_2

GRANT RECEIVE ON [dbo].[Quest_Event_Notification_Queue_w2k3-7_DB_2_1] TO
[dbo]

GRANT SEND ON SERVICE::[Quest_Event_Notification_Service_w2k3-7_DB_2_1] TO
[public]

/*Run this script on the server #2*/

USE DB_1

CREATE ROUTE
[Quest_4efb1caf-622d-424f-8ae0-7e01019ed9a3_Quest_Event_Notification_Service_w2k3-7_DB_2_1]
WITH SERVICE_NAME = 'Quest_Event_Notification_Service_w2k3-7_DB_2_1',
BROKER_INSTANCE = '4EFB1CAF-622D-424F-8AE0-7E01019ED9A3', ADDRESS =
'TCP://W2K3-7:4022'

/*Run this script on the server #1*/

USE DB_2

CREATE ROUTE
[Quest_9f3a9be7-0d81-4cc7-bb86-8c2bfbc32c50_http://schemas.microsoft.com/SQL/Notifications/EventNotificationService]
WITH SERVICE_NAME =
'http://schemas.microsoft.com/SQL/Notifications/EventNotificationService',
BROKER_INSTANCE = '9F3A9BE7-0D81-4CC7-BB86-8C2BFBC32C50', ADDRESS =
'TCP://W2K3-6:4022'

/*Run this script on the server #2*/

USE DB_1

CREATE EVENT NOTIFICATION [EN] ON DATABASE FOR CREATE_TABLE, ALTER_TABLE,
DROP_TABLE TO SERVICE 'Quest_Event_Notification_Service_w2k3-7_DB_2_1'
,'4efb1caf-622d-424f-8ae0-7e01019ed9a3';

-- Then execute the notification action:

Use DB_1

create table Tab_1 (col1 int)

Result:

Notification message delivered to the target queue
[Quest_Event_Notification_Queue_w2k3-7_DB_2_1] BUT the same message still
existed in transmission queue with Empty status.

I tried to trace the process by SQL Profiler. It represented the following:

This message could not be delivered because another instance of this service
program has already started conversing with this endpoint.

Note: all the following messages for this event are not delivered to the
target queue. They all stayed in the transmission queue with empty status.
When I drop Event Notification, all messages from transmission queue are
delivered to the target queue.
Roger Wolter[MSFT] - 05 Jun 2006 16:24 GMT
1)  When you send a message to another database in the same instance, the
sender must impersonate a user on the receiver database to insert the
message in the target queue.  In order to do this impersonation, the
initiator requires the trustworthy bit.  When you send a message to a remote
database without dialog security, the message comes in with no identity so
the target service must accept connections from public.  The SQL Security
model doesn't allow this between databases in the same instance.

2) Event notifications should require this also

3)  Try dropping the instance identifier from the return route.  It sounds
like you're using the wrong instance.

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> Hello,
>
[quoted text clipped - 115 lines]
> When I drop Event Notification, all messages from transmission queue are
> delivered to the target queue.
Alex Petrovsky - 05 Jun 2006 18:08 GMT
Thanks for the reply.

> 1) When you send a message to another database in the same instance, the

> sender must impersonate a user on the receiver database to insert the

> message in the target queue. In order to do this impersonation, the

> initiator requires the trustworthy bit. When you send a message to a
> remote

> database without dialog security, the message comes in with no identity so

> the target service must accept connections from public. The SQL Security

> model doesn't allow this between databases in the same instance.

[AP]: Now it is clear.

> 2) Event notifications should require this also

[AP]: Do you mean that these settings are recommended for using Event
notifications with remote databases?

I use Event notifications without these settings and notification succeeds.

> 3) Try dropping the instance identifier from the return route. It sounds

> like you're using the wrong instance.

[AP]: Do you mean BROKER_INSTANCE = 'broker_instance_identifier'?

If it is so, we have dropped this optional parameter from the script for
target route but it did not help.

The error is the same.

What could you recommed us to resolve the problem?
Roger Wolter[MSFT] - 06 Jun 2006 17:36 GMT
You could try dropping the instance from the return route as I said instead
of from the target route (unless I misunderstand what you're saying).  Trace
both endpoints and the connections to see if there are any other messages.
You might also try just sending a message to your service to see if it's
something unique to your event setup.  Are you running SP1 on both systems?

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> Thanks for the reply.
>
[quoted text clipped - 36 lines]
>
> What could you recommed us to resolve the problem?
Alex Petrovsky - 07 Jun 2006 12:55 GMT
I have found the reason. The 'broker_instance_specifier' parameter value
should be of the upper case in CREATE EVENT NOTIFICATION statement. It's
very strange because server has case insensitive collation.

> You could try dropping the instance from the return route as I said
> instead of from the target route (unless I misunderstand what you're
> saying).  Trace both endpoints and the connections to see if there are any
> other messages. You might also try just sending a message to your service
> to see if it's something unique to your event setup.  Are you running SP1
> on both systems?
Roger Wolter[MSFT] - 07 Jun 2006 15:35 GMT
Service Broker names which have to be sent over the wire must use binary
collation because there's no way to predict what the collation of the final
destination might be.

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

>I have found the reason. The 'broker_instance_specifier' parameter value
>should be of the upper case in CREATE EVENT NOTIFICATION statement. It's
[quoted text clipped - 6 lines]
>> service to see if it's something unique to your event setup.  Are you
>> running SP1 on both systems?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.