Showing posts with label sending. Show all posts
Showing posts with label sending. Show all posts

Tuesday, March 20, 2012

problem on sending message

Hi

few weeks ago I found an example of conversation using service broker.
I used the following code:

USE Test 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) select * from sys.service_contracts GO -- The communication is between two endpoints. Thus, we need two queues to -- hold messages CREATE QUEUE [SenderQueue] with status = on select * from sys.service_queues --CREATE QUEUE ReceiverQueue Create QUEUE [ReceiverQueue] with status = on select * from sys.service_queues GO -- Create the required services and bind them to be above created queues CREATE SERVICE [Sender] ON QUEUE [SenderQueue] (HelloContract) CREATE SERVICE [Receiver] ON QUEUE [ReceiverQueue] (HelloContract) GO

Then I try to send a message:

DECLARE @.conversationHandle UNIQUEIDENTIFIER DECLARE @.message NVARCHAR(100) BEGIN BEGIN DIALOG @.conversationHandle FROM SERVICE Sender TO SERVICE 'Receiver' ON CONTRACT HelloContract -- Send a message on the conversation SET @.message = N'Hello, World'; SEND ON CONVERSATION @.conversationHandle MESSAGE TYPE HelloMessage (@.message) END

Then I read the message in the ReceiverQueue

RECEIVE message_body FROM dbo.receiverqueue
I get no messages, can you help me to discover why?

A master key has probably not been setup for that database. See the documentation on CREATE MASTER KEY -- http://msdn2.microsoft.com/en-us/library/ms174382.aspx.

Also, when messages cannot be delivered immediately, they are placed in sys.transmission_queue.

-mike

|||

BEGIN DIALOG @.conversationHandle
FROM SERVICE Sender
TO SERVICE 'Receiver'
ON CONTRACT HelloContract
with encryption = off

|||Thanks for helping!

Monday, March 12, 2012

Problem notifying operator SS2005

Hi there!

I expercience some problems in sending the alert mails to the operator when an Agent Failure Alert happens.

I have setup MSSQL 2005 with merge replication and have setup mail the ss2005 way. I also can send test mails via the Database mail context menu.

I have setup a operator with a valid emailadress and enabled is checked
On the notifications page 'Agent Failure Alert' is checked.

When this alert fires the number of occurences in the history of this alert is incremented (as I can see via the alertsection-Agentfailure-history) this alert is also enabled. The problem is that the operator does not get notified!

So I can send test email from the DB, have setup an Operator with emailadress, have enabled an alert and see the number of occurences of this alert increment. I don't get any alert mails. The notifications attempt in the history page of the operator does not increment. It says: [never emailed]

Well I hope you can help!

Sincerley

Edward

Problem solved.

The SQL Agent still needed a pointer to the mailservice.

|||

Can someone please explain this to me ... I am having the exact same problem mentioned above (test emails work with database mail but jobs do not actually show any attempt to sed notifications).

I do not understand what is meant by "SQL Agent still needs a pointer to the mailservice".

Problem notifying operator SS2005

Hi there!

I expercience some problems in sending the alert mails to the operator when an Agent Failure Alert happens.

I have setup MSSQL 2005 with merge replication and have setup mail the ss2005 way. I also can send test mails via the Database mail context menu.

I have setup a operator with a valid emailadress and enabled is checked
On the notifications page 'Agent Failure Alert' is checked.

When this alert fires the number of occurences in the history of this alert is incremented (as I can see via the alertsection-Agentfailure-history) this alert is also enabled. The problem is that the operator does not get notified!

So I can send test email from the DB, have setup an Operator with emailadress, have enabled an alert and see the number of occurences of this alert increment. I don't get any alert mails. The notifications attempt in the history page of the operator does not increment. It says: [never emailed]

Well I hope you can help!

Sincerley

Edward

Problem solved.

The SQL Agent still needed a pointer to the mailservice.

|||

Can someone please explain this to me ... I am having the exact same problem mentioned above (test emails work with database mail but jobs do not actually show any attempt to sed notifications).

I do not understand what is meant by "SQL Agent still needs a pointer to the mailservice".