Themelia Pro A powerful new development platform built on ASP.NET.
 
Understanding Processor Factories
 
 

When creating any type of processor, it's very important to always create an associated processor factory. This will do two things: first, it allow simplier configuration registration of processors by allowing you to provides aliases to the processor, but it also increases the efficiency of processor creation. t is, therefore, very highly recommended that you always ship a processor factory with your Themelia Pro based products.

Processor factories are made by creating a class that inherits from the Themelia.Web.Processing.ProcessorFactoryBase abstract class.This class requires that you implement the following signature:

Themelia.Web.Processing.IProcessor CreateProcessor(String text)

Below is a full example of a processor factory:

public class ProcessorFactory : Themelia.Web.Processing.ProcessorFactoryBase
{
    //- @CreateProcessor -//
    public override Themelia.Web.Processing.IProcessor CreateProcessor(String text)
    {
        switch (text)
        {
            case "endpoint":
                return new EndpointInitProcessor();
            case "messagehandling":
                return new MessageHandingInitProcessor();
        }
        //+
        return null;
    }
}

Notice that a processor factory is a very simple class that implements the factory design pattern. Using the CreateProcessor class you can allow people to use various aliases for specific handlers. That is, you can obviously have more than one "case" statement for each processor entry in the "switch" statement.

Processor factories can either be installed via Themelia Pro components or via direct web configuration as in the following example:

<themelia.web>
  <webDomains>
    <add>
      <factories>
        <add type="ABCCorp.Web.Processing.ProcessorFactory, ABCCorp.Web" />
      </factories>
    </add>
  </webDomains>
</themelia.web>