Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get rid of duplicate messages in MSMQ

572 views
Skip to first unread message

Jean-Marc Gautier

unread,
Oct 20, 2003, 7:38:32 AM10/20/03
to
I am running MSMQ (2.0.748) on Windows 2000 SP3 (I
installed Message Queuing after SP3 installation - as an
independent client with no access to directory service).

I have created a Service (using ATL) which sends (non-
transactional) messages to a private queue.
However, some messages are sent in duplicates (usually the
duplicate ones arrive a few minutes later) and quite a few
times the my service crashes.

As per MS KB (http://support.microsoft.com/default.aspx?
scid=kb;en-us;255546) duplicate messages shouldn't be
happening.
The registry values mentioned in the KB above -
RemoveDuplicateSize and RemoveDuplicateCleanup - do not
exist in my registry. Does that mean that duplicate
message removal mechanism is not active? Or does it mean
that it is using the default values (10000 and 30 minutes).

If I am to add these registry values manually, can anyone
tell me the units (seconds/minutes) that I should set
up "RemoveDuplicateCleanup" value with?

Any help will be greatly appreciated.

Doron Juster [MSFT]

unread,
Oct 21, 2003, 4:07:34 AM10/21/03
to
You don't need to add any registry value in order to enable the
duplicate-removal mechanism. Default values are used. Are the duplicate
messages identical ? same message ID ?
Is it local send or are these messages received from remote computers ?

Thanks, Doron
--
This posting is provided "AS IS" with no warranties, and confers no rights.
.

"Jean-Marc Gautier" <anon...@discussions.microsoft.com> wrote in message
news:08d201c396fe$b0b16060$a101...@phx.gbl...

Jean-Marc Gautier

unread,
Oct 21, 2003, 4:35:57 AM10/21/03
to
It is a local send (to a local private queue with format
name DIRECT=OS:.\PRIVATE$\RequestQ_001).
The message ID is different - in all other ways the
messages are identical (except that the duplicate ones
reach a few minutes later).

The code is reproduced below:

HRESULT SendMsg(
WCHAR *pwszComputerName,
WCHAR *pwszQueueName,
_bstr_t & bstrLabel,
_bstr_t & bstrBody)
{
HRESULT hr = E_FAIL;
WCHAR *pTmpPathName=NULL;
try
{
MQ::IMSMQQueueInfoPtr pInfo("MSMQ.MSMQQueueInfo");
MQ::IMSMQQueuePtr qSend;
MQ::IMSMQMessagePtr pMsg("MSMQ.MSMQMessage");
WCHAR *pFormatName = L"DIRECT=OS:";
int nSize=0;
nSize = wcslen(pFormatName) +
wcslen(pwszComputerName) +
wcslen(pwszQueueName) + 2;
pTmpPathName = new WCHAR [nSize];
if(pTmpPathName)
{
wcscpy(pTmpPathName, pFormatName);
wcscat(pTmpPathName, pwszComputerName);
wcscat(pTmpPathName, L"\\");
wcscat(pTmpPathName, pwszQueueName);
pInfo->FormatName = pTmpPathName;
}
qSend = pInfo->Open(
MQ::MQ_SEND_ACCESS,
MQ::MQ_DENY_NONE);
pMsg->Label = bstrLabel;
pMsg->Body = _variant_t(bstrBody);
//pInfo->Refresh();//REVIEW: is this necessary?
if(0 == pInfo->IsTransactional)
pMsg->Send(qSend,
&variant_t((long)MQ::MQ_NO_TRANSACTION));
else
pMsg->Send(qSend,
&variant_t((long)MQ::MQ_SINGLE_MESSAGE));
qSend->Close();
hr = S_OK;
}
catch(_com_error & comError)
{
hr = comError.Error();
LogError(_T("SendMsg():hr=0x%x"), hr);
}
catch(...)
{
hr = E_FAIL;
LogError(_T("SendMsg():Unknown Exception"));
}
if(pTmpPathName)delete pTmpPathName;
return hr;

Doron Juster [MSFT]

unread,
Oct 23, 2003, 9:05:36 AM10/23/03
to
If message ID is different, then these are not duplicate, as far as msmq is
concerned.
Please check your code to see why you send same message multiple times. You
can put a breakpoint on MQSendMessage and see how it is called. Messages
sent locally cannot be duplicated anyway.

Thanks, Doron
--
This posting is provided "AS IS" with no warranties, and confers no rights.
.

"Jean-Marc Gautier" <anon...@discussions.microsoft.com> wrote in message

news:026501c397ae$593dec80$a001...@phx.gbl...

0 new messages