Event Sink Event Choices - Microsoft Exchange

This is a discussion on Event Sink Event Choices - Microsoft Exchange ; 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 ...

+ Reply to Thread
Results 1 to 5 of 5

Event Sink Event Choices

  1. Default 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

  2. Default 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


  3. Default 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/de...d1b7270dac.asp



    To access the message in onsubmission sink you need to use the MailMsg
    object see
    http://msdn.microsoft.com/library/de...760c05b320.asp
    someone posted a sample a while back using C# have a look at

    http://groups.google.com.au/group/mi...f38947fb099e52



    Cheers

    Glen





    "David A. Coursey" <dcoursey@ILOVESPAM_gmail.com> 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




  4. Default 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/de...d1b7270dac.asp
    >
    >
    >
    > To access the message in onsubmission sink you need to use the MailMsg
    > object see
    > http://msdn.microsoft.com/library/de...760c05b320.asp
    > someone posted a sample a while back using C# have a look at
    >
    > http://groups.google.com.au/group/mi...f38947fb099e52
    >
    >
    >
    > Cheers
    >
    > Glen
    >
    >
    >
    >
    >
    > "David A. Coursey" <dcoursey@ILOVESPAM_gmail.com> 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

    >
    >
    >


  5. Default 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);
    }
    }


+ Reply to Thread

Similar Threads

  1. event sink
    By Application Development in forum Microsoft Exchange
    Replies: 1
    Last Post: 11-17-2006, 04:42 PM
  2. event sink ?
    By Application Development in forum Microsoft Exchange
    Replies: 0
    Last Post: 10-13-2005, 06:30 PM
  3. Categorizer event sink / routing event sink
    By Application Development in forum Microsoft Exchange
    Replies: 4
    Last Post: 07-19-2005, 06:26 PM
  4. event sink ; help !!
    By Application Development in forum Microsoft Exchange
    Replies: 1
    Last Post: 12-17-2003, 08:55 AM
  5. Need Help with Event Sink
    By Application Development in forum Microsoft Exchange
    Replies: 0
    Last Post: 10-01-2003, 02:13 PM