Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Tue, 6 Dec 2005 06:37:03 -0800,    group: microsoft.public.exchange2000.development        back       


Event Sink Event Choices   
I have read all the docs, but I am a little fuzzy on what event I should 
choose.  I think I should use either OnArrival or OnMessageSubmission.   I 
want to be able to access the SMTP envelope and the message with attachments 
before the message is written to disk.

I started writing using OnMessageSubmission, but I can't find how to access 
the message and attachments.  I see multiple examples online on how to use 
OnArrival, but I was working under the assumption that OnMessageSubmission 
would better suit my needs.

Thanks for looking
dave
date: Tue, 6 Dec 2005 06:37:03 -0800   author:   David A. Coursey

RE: Event Sink Event Choices   
I should probably add that I need high performance.  This sink will process 
about 10k messages a day with 15% growth per month.  

"David A. Coursey" wrote:

> I have read all the docs, but I am a little fuzzy on what event I should 
> choose.  I think I should use either OnArrival or OnMessageSubmission.   I 
> want to be able to access the SMTP envelope and the message with attachments 
> before the message is written to disk.
> 
> I started writing using OnMessageSubmission, but I can't find how to access 
> the message and attachments.  I see multiple examples online on how to use 
> OnArrival, but I was working under the assumption that OnMessageSubmission 
> would better suit my needs.
> 
> Thanks for looking
> dave
date: Tue, 6 Dec 2005 07:04:02 -0800   author:   David A. Coursey

Re: Event Sink Event Choices   
What language are you programming in if your talking high volume this is 
always going to be a determining factor if you haven't already you should 
have read the following in the doco regard VB

" The event dispatcher thread executes in the multithreaded apartment (MTA) 
of the IIS service process. If an event sink COM class is registered to 
execute only in a single-threaded apartment (STA), the COM runtime will 
automatically create the necessary STA in the process and will serialize 
calls to the object in the standard way. If the in-process class is 
registered as supporting MTA and STA or MTA only, no marshalling is 
required. If the sink resides in a separate apartment, all interfaces must 
be marshalled across the apartment boundaries. This marshalling can degrade 
performance and may be a poor option for high-volume SMTP and NNTP services. 
Sinks written with scripting languages and Microsoft Visual Basic run in 
STAs"



This one paragraph is very telling in regards to writing a sink that is 
going to perform well under heavy load even if your not using VB making sure 
your sink runs inprocess and uses a minium number of Interfaces etc.



In regards to what's best to use for a high volume sink there is overhead 
associated with onarrival "The major drawback is that the CDO interface adds 
significant overhead and is synchronous. The CDO_OnArrival event is most 
appropriate for sinks that are run on very few messages. The 
OnSubmission/OnArrival event is the only event that offers a CDO interface 
and the ability to write event sinks in Visual Basic or VBScript. The 
OnSubmission event is the place to add new recipients to the message. " from 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/smtpevt/html/6e033d3f-d84f-453e-81cf-65d1b7270dac.asp



To access the message in onsubmission sink you need to use the MailMsg 
object see 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/smtpevt/html/24b599a5-671f-4310-8239-cb760c05b320.asp 
someone posted a sample a while back using C# have a look at

http://groups.google.com.au/group/microsoft.public.exchange.development/browse_frm/thread/8cdab7454d70056/91f38947fb099e52?lnk=st&q=onsubmission+c%23&rnum=4&hl=en#91f38947fb099e52



Cheers

Glen





"David A. Coursey"  wrote in message 
news:9B552827-A8D5-405C-A83C-90D8F5436739@microsoft.com...
>I should probably add that I need high performance.  This sink will process
> about 10k messages a day with 15% growth per month.
>
> "David A. Coursey" wrote:
>
>> I have read all the docs, but I am a little fuzzy on what event I should
>> choose.  I think I should use either OnArrival or OnMessageSubmission. 
>> I
>> want to be able to access the SMTP envelope and the message with 
>> attachments
>> before the message is written to disk.
>>
>> I started writing using OnMessageSubmission, but I can't find how to 
>> access
>> the message and attachments.  I see multiple examples online on how to 
>> use
>> OnArrival, but I was working under the assumption that 
>> OnMessageSubmission
>> would better suit my needs.
>>
>> Thanks for looking
>> dave
date: Wed, 7 Dec 2005 15:39:18 +1100   author:   Glen Scales [MVP]

Re: Event Sink Event Choices   
Yeah, I had already read those articles, and pretty much guessed that I would 
stick with OnTransportSubmission.  I just couldn't find how to access the 
message.  My fears were that you were going to post saying that I can't 
access the message.  :)   I'm writing this in C# 2.0

For whatever reason, when I searched google groups I never found that 
example you posted.  Once again you come to the rescue!

I'm going to document this pretty heavily once I'm finished.  I don't have a 
blog, but maybe I'll write something for Outlook Exchange.

Thanks,
dave
"Glen Scales [MVP]" wrote:

> What language are you programming in if your talking high volume this is 
> always going to be a determining factor if you haven't already you should 
> have read the following in the doco regard VB
> 
> " The event dispatcher thread executes in the multithreaded apartment (MTA) 
> of the IIS service process. If an event sink COM class is registered to 
> execute only in a single-threaded apartment (STA), the COM runtime will 
> automatically create the necessary STA in the process and will serialize 
> calls to the object in the standard way. If the in-process class is 
> registered as supporting MTA and STA or MTA only, no marshalling is 
> required. If the sink resides in a separate apartment, all interfaces must 
> be marshalled across the apartment boundaries. This marshalling can degrade 
> performance and may be a poor option for high-volume SMTP and NNTP services. 
> Sinks written with scripting languages and Microsoft® Visual Basic® run in 
> STAs"
> 
> 
> 
> This one paragraph is very telling in regards to writing a sink that is 
> going to perform well under heavy load even if your not using VB making sure 
> your sink runs inprocess and uses a minium number of Interfaces etc.
> 
> 
> 
> In regards to what's best to use for a high volume sink there is overhead 
> associated with onarrival "The major drawback is that the CDO interface adds 
> significant overhead and is synchronous. The CDO_OnArrival event is most 
> appropriate for sinks that are run on very few messages. The 
> OnSubmission/OnArrival event is the only event that offers a CDO interface 
> and the ability to write event sinks in Visual Basic or VBScript. The 
> OnSubmission event is the place to add new recipients to the message. " from 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/smtpevt/html/6e033d3f-d84f-453e-81cf-65d1b7270dac.asp
> 
> 
> 
> To access the message in onsubmission sink you need to use the MailMsg 
> object see 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/smtpevt/html/24b599a5-671f-4310-8239-cb760c05b320.asp 
> someone posted a sample a while back using C# have a look at
> 
> http://groups.google.com.au/group/microsoft.public.exchange.development/browse_frm/thread/8cdab7454d70056/91f38947fb099e52?lnk=st&q=onsubmission+c%23&rnum=4&hl=en#91f38947fb099e52
> 
> 
> 
> Cheers
> 
> Glen
> 
> 
> 
> 
> 
> "David A. Coursey"  wrote in message 
> news:9B552827-A8D5-405C-A83C-90D8F5436739@microsoft.com...
> >I should probably add that I need high performance.  This sink will process
> > about 10k messages a day with 15% growth per month.
> >
> > "David A. Coursey" wrote:
> >
> >> I have read all the docs, but I am a little fuzzy on what event I should
> >> choose.  I think I should use either OnArrival or OnMessageSubmission. 
> >> I
> >> want to be able to access the SMTP envelope and the message with 
> >> attachments
> >> before the message is written to disk.
> >>
> >> I started writing using OnMessageSubmission, but I can't find how to 
> >> access
> >> the message and attachments.  I see multiple examples online on how to 
> >> use
> >> OnArrival, but I was working under the assumption that 
> >> OnMessageSubmission
> >> would better suit my needs.
> >>
> >> Thanks for looking
> >> dave 
> 
> 
>
date: Wed, 7 Dec 2005 07:05:04 -0800   author:   David A. Coursey

Re: Event Sink Event Choices   
Ok, I am officially getting my ass handed to me.  I can access the messages 
properties, but I just can't get MailMsg.ReadContent to work.  Any ideas on 
what I'm missing?


private void ProcessMail()
{
	uint size = message.SizeHint;
	uint outSize = 0;
	IntPtr ptr = new IntPtr();

	try
	{
		IMailMsgNotify notify = (IMailMsgNotify)new object(); //<--This is where 
I'm getting confused.
		//There is oviously no constructor, and I have no idea how to use 
IMailMsgNotify
		notify.Notify(1);
		message.MailMsg.ReadContent(0, size, out outSize, ptr, notify);

		TextLog.LogEvent(outSize.ToString() + " bytes read.", dt);
	}
	catch (Exception ex)
	{
		TextLog.LogError(ex.Message, dt);
	}			
}
date: Thu, 8 Dec 2005 13:09:02 -0800   author:   David A. Coursey

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us