I have a strange problem with messages getting stuck in a transmission queue. The set up is as follows:
1. Client database behind physical firewall
2. Firewall rules forward inbound traffic to Client Database
3. Server database has route to firewall
4. Client and Server databases on different physical networks
Over the last couple of days, the IP address of the PC that has the Client database on it changed. Messages were getting through to the Server from the Client but not the other way round. I presume this also meant that message acknowledgements were also not getting back to the Client because messages were stuck in the Client transmission queue.
Looking in more detail at the queued messages at the Server side, it appeared that the Server had received the messages, processed them, and sent back an end conversation. The state of the conversation in conversation_endpoints was DISCONNECTED OUTBOUND. Which I assume means that these would never get through to the Client?
What is the correct way of dealing with this situation? I tried doing an end conversation with cleanup at the Server end but this is clearly wrong because this removes any trace of the conversation from the Server and means that the messages now get through correclty (again) and processed (again). Meaning that we now have duplicate messages in our database.
1. drop receiver side service broker with sql command : drop service [//TyMetrix360Audit/DataWriter]
2. send a message from the sender.
3. now the sys.transmission_queue on the sender keeps the message.
The relevant tables on the sender and receiver no look like this:
the following summarizes the transmission queue on the SENDER:
conversation handle message_body transmission status 5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 my message in binary, ie 0x.F4E1.... <blank>
the following summarizes the sys.conversation_endpoints on the SENDER:
conversation handle conversation_id state 5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 461891C8-5D53-4D89-A7C6-097FE2EDB22A CO
the following summarizes the transmission queue on the RECEIVER:
conversation handle message_body transmission status 5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 message body of error message...... One or more messages could not be delivered to the local service targeted by this dialog.
the following summarizes the sys.conversation_endpoints on the RECEIVER:
conversation handle conversation_id state 5A0F1D1F-449C-DC11-8EED-0002B3D9F7B5 461891C8-5D53-4D89-A7C6-097FE2EDB22A DO
What do I do now?
There is a message stuck in the sender transmission queue. You responded in my last post that I need to do a RECIEVE on the sender and end the conversation myself? This is not helping me. I am still confused about the answer to this. Can you provide some sort of code outline or steps to resolve this issue. As of now I do not know how to resend my messages stuck in the sender transmission queue and they can not be lost when the conversation is ended.
Also, I thought SQL Service broker was supposed to hadle things like this. It is common for the receiver to not be there. In this case the messages should resend automatically once the receiver is back up. Please help as there is no documentation online about how to resolve this issue and your last response was not adequate.
1) I drop the Service Broker on the Receiver by running the following sql script:
if exists (select * from sys.services where name = N'//TyMetrix360Audit/DataWriter') drop service [//TyMetrix360Audit/DataWriter]
2) I send some messages using the SQL Service broker on the sender side
3) The messages I send stay in sender transmission queue. Here is an example of what my transmission queue looks like after running select * from sys.transmission_queue on the sender.
02C54400-309C-DC11-8EED-0002B3D9F7B5 //TyMetrix360Audit/DataWriter 386DDD04-7E55-466A-BE83-37EFC20910B9 tcp://SFT3DEVSQL01:4022/TyMetrix360Audit/DataSender //TyMetrix360Audit/Contract 2007-11-26 14:58:10.207 0 //TyMetrix360Audit/Message 0 0 0x3C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022007500740066002D003100360022003F003E000D000A003C0045006E0074006500720070007200690073006500410075006400690074004400610074006100200078006D006C006E0073003A007800730069003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002D0069006E007300740061006E00630065002200200078006D006C006E0073003A007800730064003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D00610022003E000D000A00200020003C005400610062006C0065004E0061006D0065003E004E004500540057004F0052004B003C002F005400610062006C0065004E0061006D0065003E000D000A00200020003C005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E006E006500740077006F0072006B005F00690064003C002F005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E000D000A00200020003C004F007000650072006100740069006F006E003E0055003C002F004F007000650072006100740069006F006E003E000D000A00200020003C004400620055007300650072003E00640062006F003C002F004400620055007300650072003E000D000A00200020003C004400610074006100620061007300650020002F003E000D000A00200020003C0044006100740061003E000D000A0020002000200020003C00780073003A0073006300680065006D0061002000690064003D0022004E006500770044006100740061005300650074002200200078006D006C006E0073003D0022002200200078006D006C006E0073003A00780073003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002200200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D007300640061007400610022003E000D000A002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022004E00650077004400610074006100530065007400220020006D00730064006100740061003A004900730044006100740061005300650074003D0022007400720075006500220020006D00730064006100740061003A004D00610069006E0044006100740061005400610062006C0065003D0022004400610074006100220020006D00730064006100740061003A00550073006500430075007200720065006E0074004C006F00630061006C0065003D002200740072007500650022003E000D000A00200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020003C00780073003A00630068006F0069006300650020006D0069006E004F00630063007500720073003D0022003000220020006D00610078004F00630063007500720073003D00220075006E0062006F0075006E0064006500640022003E000D000A002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D002200440061007400610022003E000D000A00200020002000200020002000200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C00780073003A00730065007100750065006E00630065003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F00690064002200200074007900700065003D002200780073003A0069006E007400220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F006E0061006D0065002200200074007900700065003D002200780073003A0073007400720069006E006700220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C002F00780073003A00730065007100750065006E00630065003E000D000A00200020002000200020002000200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020002000200020002000200020003C002F00780073003A00630068006F006900630065003E000D000A00200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020003C002F00780073003A0073006300680065006D0061003E000D000A0020002000200020003C006400690066006600670072003A0064006900660066006700720061006D00200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D00730064006100740061002200200078006D006C006E0073003A006400690066006600670072003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D0064006900660066006700720061006D002D007600310022003E000D000A002000200020002000200020003C0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A00200020002000200020002000200020003C00440061007400610020006400690066006600670072003A00690064003D00220044006100740061003100220020006D00730064006100740061003A0072006F0077004F0072006400650072003D002200300022003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F00690064003E0031003C002F006E006500740077006F0072006B005F00690064003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F006E0061006D0065003E00780066006400660064006600640066003C002F006E006500740077006F0072006B005F006E0061006D0065003E000D000A00200020002000200020002000200020003C002F0044006100740061003E000D000A002000200020002000200020003C002F0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A0020002000200020003C002F006400690066006600670072003A0064006900660066006700720061006D003E000D000A00200020003C002F0044006100740061003E000D000A00200020003C004F007000650072006100740069006F006E00540069006D0065003E0032003000300037002D00310031002D00320036005400310034003A00350038003A00310030002E0030003900380036003100350035005A003C002F004F007000650072006100740069006F006E00540069006D0065003E000D000A00200020003C0042006C006F00620043006F006C0075006D006E004E0061006D006500730020002F003E000D000A00200020003C0042006C006F00620047005500490044003E00630061006200610037006500660039002D0066003500650065002D0034006200370035002D0061006400360030002D003000390063003500330038003500640031003100310031003C002F0042006C006F00620047005500490044003E000D000A003C002F0045006E00740065007200700072006900730065004100750064006900740044006100740061003E00 Service Broker received an error message on this conversation. Service Broker will not transmit the message; it will be held until the application ends the conversation. F620FA2D-309C-DC11-8EED-0002B3D9F7B5 //TyMetrix360Audit/DataWriter 386DDD04-7E55-466A-BE83-37EFC20910B9 tcp://SFT3DEVSQL01:4022/TyMetrix360Audit/DataSender //TyMetrix360Audit/Contract 2007-11-26 14:59:26.813 0 //TyMetrix360Audit/Message 0 0 0x3C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022007500740066002D003100360022003F003E000D000A003C0045006E0074006500720070007200690073006500410075006400690074004400610074006100200078006D006C006E0073003A007800730069003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002D0069006E007300740061006E00630065002200200078006D006C006E0073003A007800730064003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D00610022003E000D000A00200020003C005400610062006C0065004E0061006D0065003E004E004500540057004F0052004B003C002F005400610062006C0065004E0061006D0065003E000D000A00200020003C005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E006E006500740077006F0072006B005F00690064003C002F005000720069006D0061007200790043006F006C0075006D006E004E0061006D0065003E000D000A00200020003C004F007000650072006100740069006F006E003E0055003C002F004F007000650072006100740069006F006E003E000D000A00200020003C004400620055007300650072003E00640062006F003C002F004400620055007300650072003E000D000A00200020003C004400610074006100620061007300650020002F003E000D000A00200020003C0044006100740061003E000D000A0020002000200020003C00780073003A0073006300680065006D0061002000690064003D0022004E006500770044006100740061005300650074002200200078006D006C006E0073003D0022002200200078006D006C006E0073003A00780073003D00220068007400740070003A002F002F007700770077002E00770033002E006F00720067002F0032003000300031002F0058004D004C0053006300680065006D0061002200200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D007300640061007400610022003E000D000A002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022004E00650077004400610074006100530065007400220020006D00730064006100740061003A004900730044006100740061005300650074003D0022007400720075006500220020006D00730064006100740061003A004D00610069006E0044006100740061005400610062006C0065003D0022004400610074006100220020006D00730064006100740061003A00550073006500430075007200720065006E0074004C006F00630061006C0065003D002200740072007500650022003E000D000A00200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020003C00780073003A00630068006F0069006300650020006D0069006E004F00630063007500720073003D0022003000220020006D00610078004F00630063007500720073003D00220075006E0062006F0075006E0064006500640022003E000D000A002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D002200440061007400610022003E000D000A00200020002000200020002000200020002000200020002000200020003C00780073003A0063006F006D0070006C006500780054007900700065003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C00780073003A00730065007100750065006E00630065003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F00690064002200200074007900700065003D002200780073003A0069006E007400220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A002000200020002000200020002000200020002000200020002000200020002000200020003C00780073003A0065006C0065006D0065006E00740020006E0061006D0065003D0022006E006500740077006F0072006B005F006E0061006D0065002200200074007900700065003D002200780073003A0073007400720069006E006700220020006D0069006E004F00630063007500720073003D0022003000220020002F003E000D000A0020002000200020002000200020002000200020002000200020002000200020003C002F00780073003A00730065007100750065006E00630065003E000D000A00200020002000200020002000200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020002000200020002000200020003C002F00780073003A00630068006F006900630065003E000D000A00200020002000200020002000200020003C002F00780073003A0063006F006D0070006C006500780054007900700065003E000D000A002000200020002000200020003C002F00780073003A0065006C0065006D0065006E0074003E000D000A0020002000200020003C002F00780073003A0073006300680065006D0061003E000D000A0020002000200020003C006400690066006600670072003A0064006900660066006700720061006D00200078006D006C006E0073003A006D00730064006100740061003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D006D00730064006100740061002200200078006D006C006E0073003A006400690066006600670072003D002200750072006E003A0073006300680065006D00610073002D006D006900630072006F0073006F00660074002D0063006F006D003A0078006D006C002D0064006900660066006700720061006D002D007600310022003E000D000A002000200020002000200020003C0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A00200020002000200020002000200020003C00440061007400610020006400690066006600670072003A00690064003D00220044006100740061003100220020006D00730064006100740061003A0072006F0077004F0072006400650072003D002200300022003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F00690064003E0031003C002F006E006500740077006F0072006B005F00690064003E000D000A0020002000200020002000200020002000200020003C006E006500740077006F0072006B005F006E0061006D0065003E00780066006400660064006600640066003C002F006E006500740077006F0072006B005F006E0061006D0065003E000D000A00200020002000200020002000200020003C002F0044006100740061003E000D000A002000200020002000200020003C002F0044006F00630075006D0065006E00740045006C0065006D0065006E0074003E000D000A0020002000200020003C002F006400690066006600670072003A0064006900660066006700720061006D003E000D000A00200020003C002F0044006100740061003E000D000A00200020003C004F007000650072006100740069006F006E00540069006D0065003E0032003000300037002D00310031002D00320036005400310034003A00350039003A00320036002E0037003800340036003400330031005A003C002F004F007000650072006100740069006F006E00540069006D0065003E000D000A00200020003C0042006C006F00620043006F006C0075006D006E004E0061006D006500730020002F003E000D000A00200020003C0042006C006F00620047005500490044003E00350034006300380036006200330036002D0061006300330066002D0034006600300034002D0062006600660066002D003400310062003800310065003500360035006500360066003C002F0042006C006F00620047005500490044003E000D000A003C002F0045006E00740065007200700072006900730065004100750064006900740044006100740061003E00 Service Broker received an error message on this conversation. Service Broker will not transmit the message; it will be held until the application ends the conversation.
The main point is that the sys.transmission queue retains the messages with the error 'Service Broker will not transmit the message; it will be held until the application ends the conversation.'
4. I execute the following sql statment on the sender:
select * from sys.conversation_endpoints
and see that the conversation that sent the messages are in state 'ER'
5. I then recreate the receiver with the following script:
create service [//TyMetrix360Audit/DataWriter] authorization dbo on queue dbo.TyMetrix360AuditQueue([//TyMetrix360Audit/Contract])
6. I send some more messages and see that the new messages are being received and processed correctly.
7. But what of the messages stuck in the sender transmission queue. How are these messages to be resent? Since the conversations are in state 'ER' it seems they are not being resent. Do I need to write a custom SQL script to resend them? I do not want to end the conversation because the message will be lost and not resent.
So, in conclusion, the main question is:
When the receiver goes down, or the receiver service broker simply does not exist and messages pile up the sender transmission queue like in my example how do these messages get resent when the receiver is restored?
By the way when I run
select service_broker_guid from sys.databases where database_id = db_id()
Scenario: (1) Initiator/Target are running on different machines; (2) Target is on SQL Standard Edition with service pack 1; (3) Initiator ends the conversation.
If Initiator is running on SQL Express Edition with service pack 1 or 2, €śSend message€? and €śEnd conversion€? will introduce two messages in initiator€™s sys.transmission_queue. One is empty message with correct message type; the other is empty message with no message type. Both of them are from the Target to the Initiator.
If Initiator is running on SQL Standard Edition with service pack 1, with same stored procedure (attached below), there is no message left in initiator€™s sys.transmission_queue.
We like to find the way to make Initiator on SQL Express Edition acting same as it on SQL Standard Edition, namely not left messages in the initiator€™s sys.transmission_queue
CREATE PROCEDURE [dbo].[CreateMessageForQueue] @message varchar(max) AS BEGIN
SET NOCOUNT ON;
DECLARE @handle UNIQUEIDENTIFIER;
BEGIN DIALOG CONVERSATION @handle FROM SERVICE [TCP://Initiator:4321] TO SERVICE N'TCP://Target:4567' ON CONTRACT LogContract WITH ENCRYPTION = OFF;
SEND ON CONVERSATION @handle MESSAGE TYPE LogMessage(@message);
I have sent messages and they are all sitting in the transmission queue with a blank status, why is service broker not trying to send them ? They are no errors in the sql log. BOL says this is blank when it has not tried to send the message ? Service broker is definately activated in the database.
How do i force sql server to send anything in the transmission que ?
My normal scenario is tills sending live slaes to head office via service Broker queue. Sales are sent as soon as sale is made(normally tills on adsl lines), a loss of a Link to head office will still allow a sale to be made with the sale sitting in the transmission queue on the till but has not been commited at HO to adjust stock etc, until the link is back up. My worry is link goes down with several sales siting in the queue and then hardware failure. Is their a mechanism to backup the Transmission queue in the case of no link?
If you could back up the transmission queue at a till could i then take those messages and copy them into head offices queue for processing, this is in the case of my link to the till was down for a whole day but needed the daily sales from the shop,could i get the back up at end of the day and apply the messages at head office?
Any infomation on what would be the best way to recover from this event would be gratefully accepted.
any examples on a heartbeat to check the link status that is of very low cost between HO and tills bearing in mind HO needs to maintain status for large number of tills.
My transmission queue has lots of messages that will never, ever be delivered because the transmission_status = "The session keys for this conversation could not be created or accessed. The database master key is required for this operation."
How can I purge the transmission queue to get rid of this junk?
" noWrap width="1%" bgColor=#b71c0c>1. Yosi 29 Temmuz 12:19 seçenekleri göster Gönderen: "Yosi" <yus...@bizitek.com> - Bu yazarın yazdığı mesajları bul Tarih: Fri, 29 Jul 2005 02:19:00 -0700 Konu: Service Broker Cevapla | Yazara Cevap Ver | İlet | Yazdır | Sadece Mesaj | Aslını göster | Kaldır | Kötüye Kullanımı Bildir I'm trying the service broker features of SQL Server 2005. I created a
I have a web application that sets up a query notification on a queue. Normal operation works fine, but for some reason the queue being monitored disables occasionally (even with the transaction, error message, and end dialog message) pattern set up as described in Remus' blog post. When the queue disables, everything goes insane and the transmission queue, left unchecked, fills up the transmission queue with hundreds of thousands of PostQueryNotification messages. Am I doing something wrong? What should I do to mitigate this because it IS possible that the queue might disable sometimes, and I don't want drive space eaten up on a low-end SQL Express machine, if it does. Also - second question - where is the transmission queue storing all these messages? TempDB?
I want to use SSB as a mean to thread multiple SP invocation of the same procedure.
When I launched the initator processes it created in the transmission queue error messages saying for each of them that it is an invalid target service name.
The view (sys.transmission_queue) records them in this way in the status column:
"The target service name could not be found. Ensure that the service name is specified correctly and/or the routing information has been supplied."
Services and queues and activation procedure are all defined into the same database.
I drop services and queues, and i tried to create a service with the initial wrong name. Nothing happened.
Hello All,I wrote one code for sending mail by using Asp.Net+C#, My code is asfollows.private void btnSend_Click(object sender, System.EventArgs e){try{MailMessage email = new MailMessage();if(rblHtml.Checked){email.BodyFormat=MailFormat.Html;}if(rblText.Checked){email.BodyFormat=MailFormat.Text;}email.From=txtSender.Text;email.To=txtReceiver.Text;email.Subject=txtSubject.Text;email.Body=txtBody.Text;string attach1=null;if(opdAttachment1.PostedFile !=null){HttpPostedFile ulFile=opdAttachment1.PostedFile;int nFileLen=ulFile.ContentLength;if(nFileLen>0){strFileName=Path.GetFileName(opdAttachment1.Posted File.FileName);strFileName="attachment/"+strFileName;opdAttachment1.PostedFile.SaveAs(Server.MapPath(st rFileName));MailAttachment attach=newMailAttachment(Server.MapPath(strFileName));email.Attachments.Add(attach);attach1=strFileName;}}SmtpMail.SmtpServer="127.0.0.1";SmtpMail.Send(email);if(attach1 !=null){File.Delete(Server.MapPath(attach1));}lblMessage.Text="Your email has been sent successfully";catch(Exception ex){lblMessage.Visible=true;lblMessage.ForeColor=Color.Red;lblMessage.Text=ex.ToString();}When i press "SEND" button, the mail is delivered and i receive message"Your email has been sent successfully". But the mail is not deliver totarget destination.The Mail is stored in "C:Inetpubmailrootqueue" folder. After sometime, it is autometically stored in "Badmail" folder.I use Windows 2000 Professional+.net 1.1 version.I need some solution ... I am relatively new in .net .. Can anybodyhelp me please..
We are having a problem with messages getting out of transmission_queue and into the queues themselves. The queues all are actviated and enabled, and our service broker is enabled at the database level. The dba detached & reattached the db yesterday, which I believe may be the cause of this problem. Everything seems to be in order (sp ownership, activation procs, etc), except when I run:
select [name], count(*)
from sys.dm_broker_queue_monitors qm
inner join sys.service_queues sq on qm.queue_id = sq.object_id
group by [name]
I get 2 entries for each queue. And the last_activated_time is the same date as the detach event. When we reattached we had to do an alter database set enable_broker in order to get it back up and running. When I run the above query on our dev and test environments, I get only one entry per queue.
Does anyone know why this would happen? Is this a valid state for SB? And to get past it, if we can't figure out the real fix for it, we want to get a copy of all the messages in the transmission queue, do an alter database set new_broker, then replay them all into SB. We hope this fixes the root cause, but it's a guess.
At my company, we're trying to use service broker to create a client-server system where there is a head office machine and multiple outlets registered with that head office. My problem is that sometimes when a branch sends a message to the head office, it just seems to sit in the transmission queue and never gets sent. If I run a script that forcibly ends the conversations on the client machine (with cleanup), storing the message bodies and then resend them, they seem to get through fine.
The way that we send messages is by calling a t-sql stored procedure from a c# application using SqlCommand (don't know if this should make any difference).
If I monitor the Head Office machine and one of the Outlets while this is happening, on the HO I get three events in a row:
Broker: Message Classify (1 - Local) Audit Broker Conversation (2 - No Certificate) Broker: Message Undeliverable (1 - Sequenced Message) The TextData contained in the third event is: This message could not be delivered because the security context could not be retrieved.
The RoleName of the server is Initiator, and the TargetUserName is the name of the service on the Outlet.
On the Outlet I get the following event repeatedly (presumably as it continues to try sending the message) - Broker: Remote Message Acknowledgement (1 - Message With Acknowledgement Sent).
On the client the RoleName also appears to be Initiator, and the TargetUserName is blank.
This would make me suspect that certificates were missing or something, except that if I remove messages from the queue and resend them they seem to get through, and also I've checked both databases and they have the correct certificates.
Sorry for the stupid question, but I can't seem to figure it out...
There are 119 messages that are stuck in the transmission queue, all for the same queue. When I check the status of the queue (via sys.service_queues), is_receive_enabled = 1, is_activation_enabled = 1, and max_readers = 3. When I check to see if there is an active queue monitor (via sys.dm_broker_queue_monitors) there is nobody watching this queue. What would cause this queue to be active, enabled but have nobody montioring it? Is there something internal that went wrong that made these (outbound) messages get stuck in the transmission queue, and is not showing up in the views? How can I get these messages "un-stuck" and flow through the system?
A problem I am seeing is the return message to this queue (to signify the target has consumed the message, and to end the conversation) are not being consumed, thus getting stuck in the "DI" state.
For some reason the messages are stuck at sys.transmission_queue. The transmission status seems to be null. I verified all the Queues and they hae the values of (is_receive_enables = 1, is_enqueue_enabled = 1, is_activation_enabled = 0)
I have set up the service broker on different domain and have bidirectional ports open to receive messages.
I can send and receive messages, when I run the same service broker setup scripts at the machines that belongs to same domain .
Hi i am trying to create a batch process then commit for all messages on the queue. The problem i am having is when i run my query (As below) I only receive the first message and the corresponding end dialog for the message although i have 2000 records sitting in the queue. It is my understanding that receive without any criteria i.e top(1) or where clause should select everything of the queue. I tried receive top(100) expecting 100 records but still only got 2 back.
I may have a misunderstanding of how SB works, but this seems like a problem.
If a queue is disable (i.e. status = off) and a message is sent to the queue the message is placed on the sys.transmission_queue. Once the queue is enabled I thought the messages were sent to the queue in the order they were placed on the sys.tranmission_queue? I have been troubleshooting a problem and this is not the case. Do I have a misunderstanding of how the sys.transmission_queue works?
I have 2 messages types for a queue and would like to use one application that receives messages of one type from the queue and another application that will receieve messages of a different type from the same queue.
I am developing automated .Net Unit Tests, and as a prerequisite of each test, I would like to clear the service broker queues of any messages. Executing the
RECEIVE * FROM statement appears to only return a message at a time, and not all as I expected. Any ideas on how to make this happen, besides not having to delete the queues and then having to rebuild them?
In a peer to peer setup, Ann modifies a row on instance A while Bill deletes it on instance B. Bill's delete passes Ann's modify in the replication message queues; the delete succeeds on instance A, but the pending modify fails and blocks further changes from instance A. How do I get the modify out of the queue?
Thanks, Liston
PS: Yes, I know you're not supposed to do this. Why doesn't peer to peer replication come under the perview of the distributed transaction coordinator? Please - put this on my wish list.
Hello, This is info that I am still not certain about and I just need to make sure, my gut feeling is correct:
A. When a procedure is triggered upon reception of a message in a queue, what happens when the procedure fails and rolls back? 1. Message is left on the Queue. 2. is the worker procedure triggered again for the same message by the queue? 3. I am hoping the Queue keeps on triggering workers until it is empty.
My scenario is that my queue reader procedure only reads one message at a time, thus I do not loop to receive many messages.
B. For my scenario messages are independent and ordering does not matter. Thus I want to ensure my Queue reader procedures execute simultaneously. Is reading the Top message in one reader somehow blocking the queue for any other reader procedures? I.e. if I have BEGIN TRANSACTION when reading messages of the Queue, is that effectively going prevent many reader procedures working simultaneously. Again, I want to ensure that Service broker is effectively spawning procedures that work simultaneously.
I am using SQL2005 merge replication and have pull subscribers on a low bandwidth link
I am compressing the snapshot into an alternate folder. Files are not put into the default folder
When I start a synchronization, I would expect the cab file to be copied to the subscriber and then the files to be extracted locally at the subscriber in order to apply the snapshot
However, what appears to be happening is that the files are being extracted from the cab file on the publisher (in a UNC specified directory) and then copied in their uncompressed form to the subscriber - resulting in an extremely slow snapshot application.
Any ideas what I am doing wrong? I have read about the options for using FTP to transfer snapshot files, but I am not clear whether I have to use FTP in order to transmit a compressed snapshot. I don't want to use FTP unless I need to.
I have an issue in my production , SQL server 2008 R2 , in Error log it is said “ An error occurred in dialog transmission Error : 9655 , State : 3 and Error : 9736 Severity : 16 State 0
I checked in sysmessages , it is said :” The transmission queue table structure in database is inconsistent. Possible database corruption “
So do you think I need to run DBCC checkdb ? Should I run it after working hours or it is fine within working hours ?
I have spent days searching the web and forums for an answer to this simple question and cannot find an example.
I have built a service broker application on sql server 2005. The application puts some xml on an incoming queue which is basically a few parameters to be used in a query. This queue will then call a stored proc which does some business logic and puts the resulting results in another queue also in xml.
I have written a test harness in SQL to put messages on the inbound queue and then some sql to retrieve the returned code from the outbound queue.
What I want to do is be able to convert the SQL which does this into .net code to be used by an application. i.e. write in .net some code to put xml on a queue and then write some .net code to retrieve xml from another queue.
I wouldn't have thought this would be a difficult thing to do and would have been done hundreds of times, but unable to find anything to simply send and retrieve XML to service broker queues....
thanks for your help.. its really needed. I found some links, but they are really vague and often doing select statments in service broker or something like this. I don't want to call any sql, just send and recieve XML on the queues.
any example code that does this, would be really helpfull
Ok I have created a 2005 sql advanced database with text indexing. I have create the database like so created a new database with text indexing enabled and the following table create table support (problemId VARCHAR(50) NOT NULL PRIMARY KEY, problemTitle varchar(50) NOT NULL, problemBody text NOT NULL, linkOne varchar(50), linkTwo varchar(50), linkThree varchar(50), linkFour varchar(50), ftid int NOT NULL) next create fulltext catalog remoteSupportCatalog create unique index ui_remotesupport ON support (ftid) then create fulltext index on support(problemBody)key index PK__support__7C8480AE on remoteSupportCatalog -------- I then populated some rows and issues a quesry Select * from support where freetext(problemBody, 'test database') it works pulls back all the data I expected it to pull back
In my asp page I created a database connection with the folling select command <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:rsdb2ConnectionString2 %>" SelectCommand="SELECT * FROM support WHERE FREETEXT(problemBody, @srchBox)">
created the search parameter<SelectParameters> <asp:ControlParameter ControlID="srchBox" PropertyName="Text" Type="String" Name="srchBox" /> //this is a text box that is searchable with a button </SelectParameters> and it doesnt give me back an error or data it does nothing. What am I missing?????
I hate making complecated queries....but this doesn't seem too hard and I cannot figure out where my error is. The message is "Incorrect syntax near the keyword 'FROM'."
The query is: SELECT tblUsers.lUserID GROUP BY tblUsers.lUserID HAVING Count(tblDLHistory.lDownloadID) = 0 FROM tblUsers LEFT JOIN tblDLHistory ON tblUsers.lUserID = tblDLHistory.lUserID WHERE tblDLHistory.lVersionID = 5
I need to search the database and pull up all customers who have a 'device' and their email address. I have watered down my select statement, but the following is the basics of it. I just cannot figure out how to also append the email. I have tried many different attempts and have come up dry.
Select a.company From dbo.contact1 as a, ( Select DISTINCT accountno From dbo.contsupp Where contact LIKE 'Product Inventory' AND contsupref LIKE '%device%' ) as b Where a.accountno = b.accountno
Below are some sample databases to get an idea of some possibilities. There will not always be an entry in dbo.contsupp for an email address. There will not always be an entry in dbo.contsupp for a device.
I have a small table to manage orders in my company. When a new order is entered, the script makes use of the last row of the table to find out the last order, increments it and creates the new order number. The problem is, a few days ago the last row got stuck. New insertions to the table all got the same order number and are placed above the last row. Anybody has any idea what's going on?
Heres is a shorten downed example of what I am trying to achieve. I have four tables. The first being OrderHeader, the second OrderLines, the third StockCategory. The OrderHeader table contains basic order details, which in turn is linked to the OrderLines table which show if the order in the OrderHeader has a single or multiple order lines. The StockCategory table shows what stock group the item in each order line is associated to.
Here is an example of the tables in a shorten downed version (in both data and fields):
OrderHeader: Sales Order Ref, Order Date, 1, 01/05/2008 2, 01/05/2008 3, 02/05/2008 4, 02/05/2008
OrderLines: Sales Order Ref, Part Number 1, 222 1, 234 1, 333 2, 222 2, 555 2, 444 3, 333 3, 111 4, 222
StockCategory
Stock Category, Part Number, A, 222 B, 234 C, 333 D, 444 E, 111
The thing I am trying to do is assign each of the orders to a Stock Group which I can do. The thing that has baffled me is if an two of the order lines in one order are assigned to different stock groups. If this occurs I want to assign the order to the order to the stock group with the highest priority (1 being highest, 3 being lowest) for example if one order line in the order was assigned to Berr (priority 1) and the other to DFID (priority 3) the order would be assigned to Berr.
SELECT @BeginDate = [BeginDate] FROM DatePeriods AS dp WHERE dp.ID = @Period SELECT @EndDate = [EndDate] FROM DatePeriods AS dp WHERE dp.ID = @Period
SELECT COUNT(oh.[Sales Order Reference]) FROM dbo.OrderHeaders AS oh LEFT JOIN dbo.OrderLines AS ol ON oh.[Sales Order Reference] = ol.[Sales Order Reference] LEFT JOIN dbo.StockCategories AS sc ON ol.[Part Number] = sc.[Part Number] WHERE oh.[Order Date] BETWEEN @BeginDate AND @EndDate AND sc.[Stock Group] IN (SELECT sg.[Stock Group] FROM dbo.StockGroup AS sg WHERE sg.[ID] = 'Berr') AND ol.[Sales Order Reference] NOT IN (SELECT col.[Sales Order Reference] FROM dbo.CancelledOrderLines AS col WHERE col.[Part Number] = ol.[Part Number])