I have seen this buried deep with the questions on Service Broker, but I am looking for it again. How do you delete all records from your sys.Transmission_Queue. This is on a test server and I want to clean it before some more test.
I have seen this buried deep with the questions on Service Broker, but I am looking for it again. How do you delete all records from your sys.Transmission_Queue. This is on a test server and I want to clean it before some more test.
I have a SB set up that is a Fire and Forget setup, the problem I have is that it seems to be filling up TEMPDB. I see that many people have this setup without this issue.
I understand why TEMPDB is filling up but how do I prevent this without changing to a synchronous process. Currently conversations are not ending properly and the code in the target is using with cleanup.(Not my code).
As the initiator is not available the target cannot close off the end points, these are left open and eventually will be flushed from memory to TEMPDB. Remaining there until the SQL service is restarted.
I am using a trigger to kick off the initiator. How do other async processes cope with this.
Should with cleanup take care of this????
I want to build async triggers with service broker, and in trigger, we send message to queue, and there's a activated sp for that queue, but when send a message, the sp don't run. please help. 1.I already enable the broker, and set TRUSTWORTHY ON. 2.below is my queue info, I tried to use owner,'dbo',self,doesn't work. CREATE QUEUE dbo.SPITargetQueue the sp will only receive the message and insert into the another test table, I manually run it after send a message, it's ok. 3.below is meg from sys.dm_broker_queue_monitors and sys.service_queues table. name |state |tasks_waiting |activation_procedure | is_activation_enabled |execute_as_principal_id
|
hello everyone,
i want to gather queue of messages from multiple databases in one queue(using service broker)
so i create empty database containing the queue that receive the message from other databases
i wanted to know whether i can use another technique in order to in-queue messages from multiple databases in one placeThis week I was informed of the presence of Service Broker within SQL Server. I need to build an Agent Server to create asynchronous messaging capabilities for a Client/Server application I am the architect / application developer for. I have some basic
questions bridging the vision I have already in mind, and seeking the correct Service Broker term / capability to map each to. I have worked with several SQL based message queue implementations in the past.
1) May a SQL update a message?
I was intending on creating a "status" column in my queue table. Messages when created (SQL INSERT) would have a value of "new" for the status column. When the Agent Server wakes up to process requests in category "xyz" it does a SELECT for "[status] = 'new'". During the course of working on the request, the request might not be completable. In that case, the "status" column would get changed - let's say to 'error'. Thus subsequent SELECT SQL statements would no longer detect the same message.
Failed messages would simply stay in the queue for traceability. Some sort of purge process would remove messages older than n-days.
This brings me to the next question...
2) How to select for view the message queue?
Is there some way to SELECT for display all of the messages in the queue, no matter what type of message? I envision for the admin interface to the Agent Server, this being an important tool to leave in the client admin's hands.
3) What to do with unable to be completed messages?
Like I already hinted at... what happens if a message in the queue is not able to be completed for some reason? With Service Broker must the "bad" message be removed from the queue to not get reprocessed?
I think answers to these questions will provide a good start to furthering my investigation of Service Broker. Thank you!
Sincerely,
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/
Hi All,
I used service broker activation in my receive queue (SQL 2005 SP1). However, it seems the stored procedure does not work after the receive queue get message. I saw the following error in SQL Error log.
"The activated proc [dbo].[Mystoredpro] running on queue test2.dbo.ReceiveQ output the following: 'The service queue "ReceiveQ" is currently disabled.'"
Then I checked the queue in sys.service_queues and noticed is_receive_enabled and is_enqueue_enabled is 0 but not 1 (is_activation_enabled is 1, which is normal). I believe this is the cause of my service broker activation issue.
According to this link:
http://www.eggheadcafe.com/aspnet_answers/SQLServerservicebroker/May2006/post26788966.asp
I tried to use ALTER QUEUE ... WITH STATUS = ON command to set the above value back to 1, it does not work the value persists 0. Any idea?
Thanks in advance.
Michael
I have created conversation timer:
DECLARE @DialogHandle UNIQUEIDENTIFIER; BEGIN dialog CONVERSATION @DialogHandle FROM SERVICE myService TO SERVICE 'myService' ON CONTRACT [DEFAULT] WITH ENCRYPTION = OFF; BEGIN CONVERSATION TIMER (@DialogHandle) TIMEOUT = 7200;
That means that after 2 hours message will be delivered into my queue.
Where can I see which timers are active and when they will deliver the messages.
I can see the timers here:
SELECT * FROM sys.conversation_endpoints WHERE far_service='myService'
But there is no data about when this endpoint was started nor when timer will timeout and deliver the message.
Here is only dialog_timer date and lifetime date which are some different values.
thanks,
Simon
Hello all,
I have a table, schema for the table has been shown below:
Create Table Employee(
EmployeeID int NOT NULL,EmployeeName varchar(255) NOT NULL,JoinDate datetime Not NULL)
Index Structure:
Clustered Index on EmployeeID
Non-Clustered Index on EmployeName
I am execution a T-SQL query that is :
select count(*) from Employee
During the execution of this query which index will be used any why?
Thanks in advance
Pankaj Kumar Yadav-
Anyone can help with the below issue please? Much appreciated.
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
Theconnectionwas closedbytheremoteend,oran erroroccurredwhilereceivingdata: '64(The specified network name is no longer available.)'
Hello, I got this error message. The server is experiencing issue of service broker suddenly stopping, so we are ruling out all errors at this point. Server is setup with HADR.
Win Server 2008 R2 Ent SP1
SQL 2012 11.0.3349 Ent
Log Name: ApplicationThanks.
<p>I am having a devil of a time trying to get service broker working. My user has db_owner rights on two databases within the same instance. I do not have sysadmin privileges but can get them if needed. I have setup SB using 2005 successfully using different instances and now am perplexed when having these issues. before I go the 'sa' route I would like to know if setting everything up using the sysadmin priv and using 'execute as owner' on Activation procedure would alleviate my pain. I have tried everything I can think of. I shouldn't have to setup endpoints and such since this is internal to the instance, correct? If I run through everything in the tutorial as is in this instance <em>I get this.
This message could not be delivered because the targeted service does not support the service contract. Targeted service: '//ProCred_DB/CME_UpdHoursTargetService', service contract: '//UpdateCMEHours/CMEUpdateHoursContract'.</p>
BEGIN DIALOG @InitDlgHandle
FROM SERVICE [//CME_DB/CME_UpdHoursInitService]
TO SERVICE N'//ProCred_DB/CME_UpdHoursTargetService', '10C4F502-5912-4EED-BE52-CA4D28BF0044'
ON CONTRACT [//UpdateCMEHours/CMEUpdateHoursContract]
WITH ENCRYPTION = OFF;
JC
in my trigger, i get data from inserted table and send it to targetQueue.
There's a targetProc configured for that queue, in this sp, it get data from queue and do something and then end conversation.
And then a message sent back to initQueue, i have a cleanProc for this queue, this sp only receive message from initQueue and end conversation.
It will take some time and resource when generate GUID, I think it's not a good idea to generate it each time in trigger, so how can I reuse conversation handle in trigger ? Can anyone help me? Thanks a lot in advance.
i found some article about reuse conversation handle, and it's associated to @@SPID, and is this ok for trigger, and do I need to end conversation in targetProc and cleanProc ?
please give some detail message, i'm very new for this. thanks again.
Hi all,
I am creating a service broker application for a cross instance/server communication. I have been working with Service broker for sometime and I am a little comfortable. my service broker is working for the same instance (different databases messaging)
BUT what I am trying to is send a message from Server 1 to server 2. I have this working using dialog security and necessary service broker objects. Though, what I am trying to do is send a message from [Server 1 database 1] to [server 2 database 1 and database 2 ~ same instance].
i created necessary certificate on [Server 1 database 1] and [Server 2 database 1] and exchanged them then created all service broker objects. When I send a message from [Server 1 database 1] to [Server 2 database 1] everything works perfect.
BUT,
when i try to also send a message from [server 1 database 1] to [server 2 database 2] (after creating a certificate on the new database and exchange them, the messages will not be send and i see an error in the SQL profile : certificate not found (this error is on server 2 database 2).
Just to give more info, I have the same service name on server 2 database 1 & 2 ...
Your help will be much appreciated specially after spending 2 weeks on this :(
Regards,
Hello,
Why I cannot see messages on MorilloReceivingQueue? Please see the following script:
USE [master];
GO
IFEXISTS(SELECT *FROMsys.databasesWHERE [name] = 'ColasDB')
DROPDATABASE [ColasDB]
GO
CREATEDATABASE [ColasDB]
GO
ALTERDATABASE [ColasDB] SETTRUSTWORTHYON
GO
ALTERDATABASE [ColasDB] SETenable_broker
GO
USE [ColasDB];
GO
CREATEMASTERKEY ENCRYPTIONBYPASSWORD='P@ssw0rd';
CREATEMESSAGETYPE MorilloMessage
VALIDATION=WELL_FORMED_XML;
CREATECONTRACT MorilloContract
(MorilloMessageSENTBY ANY);
-- SENT BY INITIATOR
-- SENT BY TARGET
CREATEQUEUE MorilloSendingQueue
WITH
STATUS=ON
,RETENTION=OFF;
CREATEQUEUE MorilloReceivingQueue
WITH
STATUS=ON
,RETENTION=OFF;
CREATESERVICE MorilloSendingService
ONQUEUE MorilloSendingQueue
(MorilloContract);
CREATESERVICE MorilloReceivingService
ONQUEUE MorilloReceivingQueue
(MorilloContract);
CREATEROUTE MorilloRoute
WITH
SERVICE_NAME='MorilloReceivingService',
ADDRESS='LOCAL'
DECLARE @handleuniqueidentifier
BEGIN DIALOGCONVERSATION @handle
FROMSERVICE MorilloSendingService
TOSERVICE'MorilloReceivingService'
ONCONTRACT MorilloContract WITHENCRYPTION=OFF;
SENDONCONVERSATION @handle
MESSAGETYPE MorilloMessage
('<message>Hola </message>')
ENDCONVERSATION @handle WITH CLEANUP;
SELECT*FROM MorilloReceivingQueue;
Thank you in advance.
Regards,
Alberto Morillo
SQLCoffee.com
Hi All,
I'm running into a problem with SSB on
Microsoft SQL Server 2008 (SP1) - 10.0.2841.0 (X64)after a cluster failover, activation doesn't work. Queues build up until I turn activation off and back on. Is this a bug or a feature?
Mordechai Danielov
Hi Friends
I'm using
selecT
tt ,cast(start_timeasdatetime) from Call_logDetails
and getting error;
Msg 242, Level 16, State 3, Line 1
The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
Please help me to resolve this problem.
Hi
I need to code creating a service broker service.
How can i check if the service broker service exists before trying to create it?
via T-SQL or C#
BEGIN DIALOG CONVERSATION @ConversationHandle FROM SERVICE CompEngineService TO SERVICE 'CompEngineService' ON CONTRACT CompEngineContract; SEND ON CONVERSATION @ConversationHandle MESSAGE TYPE CompEngineMessageType(@TaskMessage)
DECLARE @TaskMessage xml DECLARE @Conversation_Handle uniqueIdentifier BEGIN TRY WAITFOR (RECEIVE top(1) @TaskMessage = Message_body , @Conversation_Handle = conversation_handle FROM [GenericProcessQueue] ), TIMEOUT 10000 if @@RowCount = 0 OR @taskMessage is null return <<< Fun logic goes here >>> end conversation @conversation_handle END TRY BEGIN CATCH<< LOG Conversation and Task Message to error table >> END CONVERSATION @Conversation_handle IF @@TRANCOUNT > 0 BEGIN ROLLBACK TRAN END END CATCH
S.K. Satpathy