Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

MS Exchange 2013: Transport service stops after enabling my own transport agent

$
0
0

Hi,

I am newbie to Exchange. I am learning how to create and use transport agent in Exchange2013. I have written very simple transport agent with the help of "RoutingAgent" and "RoutingAgentFactory"The Transport agent gets install properly. After the enabling it, MSExchangeTransport service startes and stops after few seconds. Following is code snippet.

namespace myTestTransport
{
    /// Agent factory for QHRoutingScanAgent
    /// Microsoft Exchange Transport service uses this factory to create object QHRoutingScanAgent object
    /// A separate object is created for each email
    public class MyRoutingScanAgentFactory : RoutingAgentFactory
    {
        //Exchange uses this method to create transport agent object for each email
        public override RoutingAgent CreateAgent(SmtpServer server)
        {
            AddressBook addressBook = (server != null) ? server.AddressBook : null;
            return new MyRoutingScanAgent(addressBook);
        }

        public MyRoutingScanAgentFactory()
            : base()
        {
        }

        ~MyRoutingScanAgentFactory()
        {

        }
    }

    public class MyRoutingScanAgent : RoutingAgent
    {
        private AddressBook addressBook;


        /// <summary>
        /// The constructor registers an end of data event handler
        /// </summary>
        public MyRoutingScanAgent(AddressBook addressBook)
        {
            this.addressBook = addressBook;
            this.OnCategorizedMessage += new CategorizedMessageEventHandler(OnCategorizedMessageHandler);
            this.OnSubmittedMessage += new SubmittedMessageEventHandler(OnSubmittedMessageHandler);
        }

        /// It is invoked by Exchange when a message has been submitted
        /// It is invoked before OnCategorizedMessageHandler event
        void OnSubmittedMessageHandler(SubmittedMessageEventSource source, QueuedMessageEventArgs e)
        {
            
        }

        /// It is invoked after OnSubmittedMessageHandler event
        /// It is called twice if email has both internal and external recipients
        void OnCategorizedMessageHandler(CategorizedMessageEventSource source, QueuedMessageEventArgs e)
        {
           

        }
    }
}

I am using Visual Studio 2008 with .net Framework 3.5.

Mailbox and Client Access servers are on same machine. (Exchange 2013)

I have tried above code with compiling with different .net versions (3.5, 4.0, 4.5), besides I hv Exchange Server 2010 SP1 Transport agent SDK installed. I have followed the instructions from here

In the event viewer there is no error logs. Kindly let me know, if I m missing something.

Thanks in advance for help.



Viewing all articles
Browse latest Browse all 7132

Trending Articles