Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Friday, March 30, 2012

Readers not queued?

When multiple readers are waiting on a message from the same queue, I would expect that the reader that has been waiting the longest would be the first to pick up a message. However, I'm shocked to discover that the opposite seems to be true; in my tests I'm showing that the reader that has been waiting the least time picks up a message first! This seems totally counter-intuitive, and I'd like to know why it's working this way. This implementation will cause a lot more reader timeouts to occur than a properly queued method. For instance, assume that I have two readers, each using a one minute timeout. Reader #1 starts waiting, and reader #2 is busy for another 20 seconds before it starts waiting. 39 seconds later a message comes in and reader #2 will pick it up, leaving reader #1 to time out one second later! I would much rather have reader #1 pick up the message and reader #2 continue to wait for 20 more seconds.

I'm considering filing a bug on Connect about this, but I thought I'd post here first and see if I can get an answer...

Following is the script I'm using to test:

Setup / Window #1

--
CREATE DATABASE SimpleSSB
GO

USE SimpleSSB
GO

--Create a database master key
CREATE MASTER KEY
ENCRYPTION BY PASSWORD = 'onteuhoeu'
GO

--Create a message type
CREATE MESSAGE TYPE Simple_Msg
VALIDATION = EMPTY
GO

--Create a contract based on the message type
CREATE CONTRACT Simple_Contract
(Simple_Msg SENT BY INITIATOR)
GO

--create a queue
CREATE QUEUE Simple_Queue
GO

--Create a service
CREATE SERVICE Simple_Service
ON QUEUE Simple_Queue
(Simple_Contract)
GO
--

Go start the other windows now

Readers: Windows #2-n

--
USE SimpleSSB
GO

WAITFOR
(
RECEIVE *
FROM Simple_Queue
), TIMEOUT 300000

--

Start at least two readers, then do
--

--send a message...
DECLARE @.h UNIQUEIDENTIFIER

BEGIN DIALOG CONVERSATION @.h
FROM SERVICE Simple_Service
TO SERVICE 'Simple_Service'
ON CONTRACT Simple_Contract
WITH ENCRYPTION=OFF;

SEND ON CONVERSATION @.h
MESSAGE TYPE Simple_Msg
GO

--

... the last reader you've started will pick up the message first. Note I'm testing on 9.0.3033, in case that matters.

Thanks!

Hi Adam,

The bevior you see is intentional. The purpose is to allow activated tasks to exit after a spike.

Suppose a traffic spike happens and suddenly all queue readers are activated to drain the queue. After the queue is drained, ideally the extra readers should go away. If we'd honor the longest waiting, then potentially all queue readers will stay active because each one will eventually get a message before the WAITFOR times out. With the behavior you see one reader will steal all messages, causing the other activated tasks to time out and exit. The same thinking goes for external readers as well.

HTH,
~ Remus

|||Hi Remus,

Thanks for the response. I agree that the behavior you're describing makes sense for activation, but in the scenario I'm working on--a farm of readers waiting on messages--it doesn't really work. I want to balance the activity across the farm so if one reader is working, the one waiting the longest will be the next to pick up a message. Any ideas?

Thanks,
Adam|||

You can't change the way WAITFOR(RECEIVE...) is notified.

If a reader is working, then it won't have any RECEIVE posted, so any available work will go to the next reader. The existing mode of operation will cause the first machine in the farm to take any load up to it's max capacity, then the next machine start picking up load until it max out, then the next and so on. What you describe would cause all machines to take an even workload and all grow simultanously until they all reach the max. Why is the first described behavior unacceptable?

An alternative to consider would be to use the broker built-in load balancing capabilities. If the same service is declared in multiple databases, then dialog targeting the said service will spread evenly across all instances of the service. Maybe you can use this feature to spread the workload.

HTH,
~ Remus

|||Hi Remus,

The reason it's unacceptable is that the readers in this case will be doing other work in addition to processing the queues. Basically, the scenario I'm working with right now is an application that already uses a load balanced server farm for doing some work, and the idea is to add some additional functionality queued via SSB. Obviously since the farm is already balanced it would be nice to also balance the SSB stuff--otherwise the "first" server in the farm is going to overload and not be able to handle the rest of its duties.

I was not aware of the load balancing feature you mention... I'll try it out and see how it fits into the scenario.

Thanks again! Your replies have been very helpful.
Adam

Friday, March 23, 2012

Read mail message with Database Mail

I have a need to read email being sent to an account. This is fairly easy
using SQL Mail, but I want to use the Database Mail provided with SQL 2k5 (a
s
SQL Mail is being phased out).
Is there a way to read mail as well as send, or is it a send only process?
Thanks!Send only. It is basic SMTP functionality.
"RC" <RC@.discussions.microsoft.com> wrote in message
news:54A67B68-CED4-426B-8DFD-7EA8900C3B12@.microsoft.com...
>I have a need to read email being sent to an account. This is fairly easy
> using SQL Mail, but I want to use the Database Mail provided with SQL 2k5
> (as
> SQL Mail is being phased out).
> Is there a way to read mail as well as send, or is it a send only process?
> Thanks!|||So in the future is this functionality going to be CLR only or is there goin
g
to be a new way to read email?
The situation boils down to company-based security difficulties in setting
up a FTP location for an external company to drop a file, but picking up an
email with the file attached is a solution I could work through.
Thanks again!
"Aaron Bertrand [SQL Server MVP]" wrote:

> Send only. It is basic SMTP functionality.
>
> "RC" <RC@.discussions.microsoft.com> wrote in message
> news:54A67B68-CED4-426B-8DFD-7EA8900C3B12@.microsoft.com...
>
>|||For what it's worth, there are several different APIs (like the Exchange OLE
DB Provider) for pulling data from Exchange Server:
http://msdn.microsoft.com/library/d...ytechnology.asp
"RC" <RC@.discussions.microsoft.com> wrote in message
news:54A67B68-CED4-426B-8DFD-7EA8900C3B12@.microsoft.com...
>I have a need to read email being sent to an account. This is fairly easy
> using SQL Mail, but I want to use the Database Mail provided with SQL 2k5
> (as
> SQL Mail is being phased out).
> Is there a way to read mail as well as send, or is it a send only process?
> Thanks!|||> So in the future is this functionality going to be CLR only or is there
> going
> to be a new way to read email?
Well, SQL Mail still exists. I don't think database mail was meant tobe a
complete swap-out replacement for SQL Mail, it was meant as an additional
feature. 99% of the installations I have seen use SQL Mail ONLY for
outgoing mail, so database mail is a much quicker and easier to configure
way to get there.
A|||I agree with Aaron that vast majority of installations that uses mail from S
QL Server only uses it
to send email.
Thing is with Database Mail is that it is SMTP (which is also the upside), a
nd SMTP is receiving
email only. If you feel that receiving email in SQL Server is very important
to you, you might want
to say so at http://lab.msdn.microsoft.com/productfeedback/
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"RC" <RC@.discussions.microsoft.com> wrote in message
news:74C9C105-2752-44CE-BCB4-D1F592447363@.microsoft.com...
> So in the future is this functionality going to be CLR only or is there go
ing
> to be a new way to read email?
> The situation boils down to company-based security difficulties in setting
> up a FTP location for an external company to drop a file, but picking up a
n
> email with the file attached is a solution I could work through.
> Thanks again!
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>|||If these files are highly sensitive or more than a couple of MB in size,
then receiving them as an attachment via email would also present problems.
"RC" <RC@.discussions.microsoft.com> wrote in message
news:74C9C105-2752-44CE-BCB4-D1F592447363@.microsoft.com...
> So in the future is this functionality going to be CLR only or is there
> going
> to be a new way to read email?
> The situation boils down to company-based security difficulties in setting
> up a FTP location for an external company to drop a file, but picking up
> an
> email with the file attached is a solution I could work through.
> Thanks again!
>
> "Aaron Bertrand [SQL Server MVP]" wrote:
>

Wednesday, March 21, 2012

'read' audit

Is there any way to identify which records in a SQL database were 'read'
and by whom? Thanks.
Message posted via http://www.droptable.comBy "read", do you mean returned by a query or involved in a query
computation? Even in a modestly large system, that could be tens of millions
of rows per day. That said, there is perhaps a method to extract this
information from a SQL Profiler event.
"Carolyn via droptable.com" <forum@.droptable.com> wrote in message
news:c8ba5f4b6213454d88acc5502db49860@.SQ
droptable.com...
> Is there any way to identify which records in a SQL database were 'read'
> and by whom? Thanks.
> --
> Message posted via http://www.droptable.com

'read' audit

Is there any way to identify which records in a SQL database were 'read'
and by whom? Thanks.
Message posted via http://www.sqlmonster.com
By "read", do you mean returned by a query or involved in a query
computation? Even in a modestly large system, that could be tens of millions
of rows per day. That said, there is perhaps a method to extract this
information from a SQL Profiler event.
"Carolyn via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:c8ba5f4b6213454d88acc5502db49860@.SQLMonster.c om...
> Is there any way to identify which records in a SQL database were 'read'
> and by whom? Thanks.
> --
> Message posted via http://www.sqlmonster.com

Reactivating an expired Subscription

Hi all,
One of the subscribers I am managing is displaying a message saying that the
pull subscription has expired although the publication properties on the
publisher is showing that the publication never expires. Is there a way to
"reactivate" the expired subscription without re-initializing it.?
Thanks
It is possible for transactional, but you are best off to drop the
subscription and do a no sync. Then run a validation and determine how out
of sync you are. After you have done this evaluate whether to proceed. You
may want to re-initialize and regenerate and deploy the snapshot. If not,
you might want to run in the continue on data consistency errors profile.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"imad koussa" <imad.koussa@.aims-co.com> wrote in message
news:ud7tR6rvFHA.3124@.TK2MSFTNGP12.phx.gbl...
> Hi all,
> One of the subscribers I am managing is displaying a message saying that
the
> pull subscription has expired although the publication properties on the
> publisher is showing that the publication never expires. Is there a way to
> "reactivate" the expired subscription without re-initializing it.?
> Thanks
>
>

Wednesday, March 7, 2012

RDA with limited connectivity

Apologies for cross posting but I can't figure where to post. Please
feel free to move my message elsewhere (notify
mat<at>oldhallsoftware<.>com) cheers
I have an ASP.net app that mobile service engineers use to exchange
info with our back office systems thru GPRS. Works great but my
company has a national phone contract and in some areas the
connectivity just isn't up to scratch.
I'm now researching a store and forward solution with Vis Studio 2005.
Have read all the help stuff but have a few questions....
I'll be saving data entered by engineers to a SQL modile db and using
RDA to send data back via existing stored procs.
Any ideas on how i test for connectivity and whether a transaction has
completed with RDA.
Any links to useful resources would be very welcomeI suggest a forum such as
http://msdn.microsoft.com/newsgroup...b&lang=en&cr=US
or the asp or c# version of it.
I have never used RDA as it has many flaws as with all mobile or semi-mobile
comms. I have, though, used merge replication from a PPC to a back ofice
using a sqlce .sdf and gprs. Merge replication automatically checks the
connection before it connects. Also, How do you use this app in dev, do you
check the connection using active sync?
"ohs" wrote:

> Apologies for cross posting but I can't figure where to post. Please
> feel free to move my message elsewhere (notify
> mat<at>oldhallsoftware<.>com) cheers
>
> I have an ASP.net app that mobile service engineers use to exchange
> info with our back office systems thru GPRS. Works great but my
> company has a national phone contract and in some areas the
> connectivity just isn't up to scratch.
> I'm now researching a store and forward solution with Vis Studio 2005.
> Have read all the help stuff but have a few questions....
> I'll be saving data entered by engineers to a SQL modile db and using
> RDA to send data back via existing stored procs.
> Any ideas on how i test for connectivity and whether a transaction has
> completed with RDA.
> Any links to useful resources would be very welcome
>

RDA push error

While trying to push a tracked table using RDA.push, I get the following error:

Error Code: 80004005

The message cannot be built. The make message failed.

Minor Err: 28581

Source: Microsoft SQL server 2005 Mobile Edition.

All other tables in the database are getting pulled and pushed correctly. This table is different only in the larger number of columns, around 150. It has a primary key, no other constraints.

Any help to find the reason for this error will be greatly appreciated.

- Paul

As far as I remember there was a bug around when you have more than 128 columns. This got fixed later in the SP1.

Thanks,

Laxmi

|||

Thanks. Laxmi.

SQL server 2005 SP1 was indeed missing, and I installed it. But now the Pull fails, with same error code, and minor error 0. Still investigating what is happening.

Thanks,

Paul

|||

Hi,

The problem persists with SQL server 2005 SP1. Any other idea please?

- Paul

|||

Sorry I should have been more clear when I have said SP1. What I meant was SQL Server Mobile/Everywhere/Compact SP1 and not SQL Server SP1. Please visit the URL below to get you more details on SQL Server Mobile/Everywhere/Compact SP1.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=774655&SiteID=1

Thanks,

Laxmi Narsimha Rao ORUGANTI

|||

I see this message from time to time in my replication thread, and shortly afterwards processes using the SDF file will start complaining that it has been corrupted.

Here is the stack trace that I receive:

28037 : A request to send data to the computer running IIS has failed. For more information, see HRESULT.

28581 : The message cannot be built. The Make Message failed.

at System.Data.SqlServerCe.NativeMethods.CheckHRESULT()

at System.Data.SqlServerCe.SyncAsyncResult.BeginSyncAndStatusReporting()

at System.Data.SqlServerCe.SyncAsyncResult.SyncThread()

The only thing that I can think of that is unusual is that one of my tables has nearly 1,000,000 rows in it. I have no more than 16 columns in any table. My large table has only 7 columns.

What exactly does the message mean? Would this be causative of my sdf corruption problems, or symptomatic?

How can I determine what SP's have been installed so I can give you better information?

Thanks,

David Johnson

RDA push error

While trying to push a tracked table using RDA.push, I get the following error:

Error Code: 80004005

The message cannot be built. The make message failed.

Minor Err: 28581

Source: Microsoft SQL server 2005 Mobile Edition.

All other tables in the database are getting pulled and pushed correctly. This table is different only in the larger number of columns, around 150. It has a primary key, no other constraints.

Any help to find the reason for this error will be greatly appreciated.

- Paul

As far as I remember there was a bug around when you have more than 128 columns. This got fixed later in the SP1.

Thanks,

Laxmi

|||

Thanks. Laxmi.

SQL server 2005 SP1 was indeed missing, and I installed it. But now the Pull fails, with same error code, and minor error 0. Still investigating what is happening.

Thanks,

Paul

|||

Hi,

The problem persists with SQL server 2005 SP1. Any other idea please?

- Paul

|||

Sorry I should have been more clear when I have said SP1. What I meant was SQL Server Mobile/Everywhere/Compact SP1 and not SQL Server SP1. Please visit the URL below to get you more details on SQL Server Mobile/Everywhere/Compact SP1.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=774655&SiteID=1

Thanks,

Laxmi Narsimha Rao ORUGANTI

|||

I see this message from time to time in my replication thread, and shortly afterwards processes using the SDF file will start complaining that it has been corrupted.

Here is the stack trace that I receive:

28037 : A request to send data to the computer running IIS has failed. For more information, see HRESULT.

28581 : The message cannot be built. The Make Message failed.

at System.Data.SqlServerCe.NativeMethods.CheckHRESULT()

at System.Data.SqlServerCe.SyncAsyncResult.BeginSyncAndStatusReporting()

at System.Data.SqlServerCe.SyncAsyncResult.SyncThread()

The only thing that I can think of that is unusual is that one of my tables has nearly 1,000,000 rows in it. I have no more than 16 columns in any table. My large table has only 7 columns.

What exactly does the message mean? Would this be causative of my sdf corruption problems, or symptomatic?

How can I determine what SP's have been installed so I can give you better information?

Thanks,

David Johnson

RDA push error

While trying to push a tracked table using RDA.push, I get the following error:

Error Code: 80004005

The message cannot be built. The make message failed.

Minor Err: 28581

Source: Microsoft SQL server 2005 Mobile Edition.

All other tables in the database are getting pulled and pushed correctly. This table is different only in the larger number of columns, around 150. It has a primary key, no other constraints.

Any help to find the reason for this error will be greatly appreciated.

- Paul

As far as I remember there was a bug around when you have more than 128 columns. This got fixed later in the SP1.

Thanks,

Laxmi

|||

Thanks. Laxmi.

SQL server 2005 SP1 was indeed missing, and I installed it. But now the Pull fails, with same error code, and minor error 0. Still investigating what is happening.

Thanks,

Paul

|||

Hi,

The problem persists with SQL server 2005 SP1. Any other idea please?

- Paul

|||

Sorry I should have been more clear when I have said SP1. What I meant was SQL Server Mobile/Everywhere/Compact SP1 and not SQL Server SP1. Please visit the URL below to get you more details on SQL Server Mobile/Everywhere/Compact SP1.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=774655&SiteID=1

Thanks,

Laxmi Narsimha Rao ORUGANTI

|||

I see this message from time to time in my replication thread, and shortly afterwards processes using the SDF file will start complaining that it has been corrupted.

Here is the stack trace that I receive:

28037 : A request to send data to the computer running IIS has failed. For more information, see HRESULT.

28581 : The message cannot be built. The Make Message failed.

at System.Data.SqlServerCe.NativeMethods.CheckHRESULT()

at System.Data.SqlServerCe.SyncAsyncResult.BeginSyncAndStatusReporting()

at System.Data.SqlServerCe.SyncAsyncResult.SyncThread()

The only thing that I can think of that is unusual is that one of my tables has nearly 1,000,000 rows in it. I have no more than 16 columns in any table. My large table has only 7 columns.

What exactly does the message mean? Would this be causative of my sdf corruption problems, or symptomatic?

How can I determine what SP's have been installed so I can give you better information?

Thanks,

David Johnson

Saturday, February 25, 2012

RDA pull error

When I try to do a pull I'm getting the following error message:

'Failure setting up a non parameterized query, possible incorrect SQL query.'

Now when I run this query in QA it works and returns me data. I'm also doing a pull on another table that works.

so I have this that works for one pull:

rda.Pull("Customers", 'select customerId, firstname, lastname, state, city from Customers", rdaConn, RdaTrackOption.TrackingOff);

and then I have this one that fails and gives me the above mentioned error:

rda.Pull("Sales", "select salesID, buyer, SaleDate from Sales', rdaConn, RdaTrackOption.TrackingOff);

and it fails.

another issue I'm having is, I can't run any rda.Pull() with RdaTrackOption.TrackingOn, any ideas on why I can't do that?

any help is greatly apprecated as for I've been going nuts on trying to figure this stuff out for the pass 2 weeks.

Anything to do with quotes? Your select starts with a double and ends in a single quote.|||

No, that was a typo when typing it in here. I should've just did a copy & paste in here.

RDA - multi table error for tracking

Hello,

I receive an error message when I try to Push data that the table is not tracked. However, when I try to turn on the tracking option it gives me an error that the table is a multi query table and therefore cannot be tracked. Here is my code to Pull the table.

string TPDAPull = string.Format("SELECT Table1.Field1,Table1.Field2, Table1.Field3, Table1.Field4, from Table1 Left Join Table2 on Table1.Field1 =Table2.Field1 WHERE Table2.Field12='{0}'", this.FindWorker(var));

rda.Pull("Table1", TPDAPull, rdaOleDbConnectString, RdaTrackOption.TrackingOn);

This table does not have a primary key. I was wondering what can I do in this situation? I do not want to Pull the whole table. Any suggestions would be greatly appreciated. I am working in VS 2005, NCF2.0, C#, WM5.0.

Thanks in advance!

What about using a subquery?|||

You could make a single table view and pull this instead (but the view must reference only ONE table).

A primary is required if using RDA tracking. See http://msdn2.microsoft.com/en-us/library/ms172971.aspx

"A primary key must be defined on the updatable recordset returned by the SELECT statement. "

|||

Thank you Erik and Graham for your replies. Erik I was wondering, can I use SubmitSql instead of Rda.push? The problem I am encountering is that I cannot change the schema of the SQL Server 2000 tables. Please let me know.

Thanks in advance!

|||Yes, of course you could use SubmitSQL, it can be used for any SQL statement that does not return rows (INSERT, EXEC sproc, UPDATE etc.)|||

Thanks Erik! I appreciate all your help.

RDA - multi table error for tracking

Hello,

I receive an error message when I try to Push data that the table is not tracked. However, when I try to turn on the tracking option it gives me an error that the table is a multi query table and therefore cannot be tracked. Here is my code to Pull the table.

string TPDAPull = string.Format("SELECT Table1.Field1,Table1.Field2, Table1.Field3, Table1.Field4, from Table1 Left Join Table2 on Table1.Field1 =Table2.Field1 WHERE Table2.Field12='{0}'", this.FindWorker(var));

rda.Pull("Table1", TPDAPull, rdaOleDbConnectString, RdaTrackOption.TrackingOn);

This table does not have a primary key. I was wondering what can I do in this situation? I do not want to Pull the whole table. Any suggestions would be greatly appreciated. I am working in VS 2005, NCF2.0, C#, WM5.0.

Thanks in advance!

What about using a subquery?|||

You could make a single table view and pull this instead (but the view must reference only ONE table).

A primary is required if using RDA tracking. See http://msdn2.microsoft.com/en-us/library/ms172971.aspx

"A primary key must be defined on the updatable recordset returned by the SELECT statement. "

|||

Thank you Erik and Graham for your replies. Erik I was wondering, can I use SubmitSql instead of Rda.push? The problem I am encountering is that I cannot change the schema of the SQL Server 2000 tables. Please let me know.

Thanks in advance!

|||Yes, of course you could use SubmitSQL, it can be used for any SQL statement that does not return rows (INSERT, EXEC sproc, UPDATE etc.)|||

Thanks Erik! I appreciate all your help.