Howto create an apache module with a sphinxserver

Hi @Putzich_Andreas, sorry for the delay in response. Let me try to help you.

In the Sparkle documentation, there is a topic about how to create an Apache module:
https://doc.tmssoftware.com/biz/sparkle/guide/server.html#apache-based-server

In step 4, it provides the code example where it adds the Sparkle module to the dispatcher:

  Server.Dispatcher.AddModule(TAnonymousServerModule.Create(
    'http://localhost/tms/hello',
    procedure(const C: THttpServerContext)
    begin
      C.Response.StatusCode := 200;
      C.Response.ContentType := 'text/html';
      C.Response.Close(TEncoding.UTF8.GetBytes('<h1>Hello, World!</h1>'));
    end
  ));

Of course, you will add the desired module to the dispatcher, in this example it's an anonymous module, but it can be a XData module (as you said, an instance of TXDataServerModule) or any other.

Those are objects of the "module layer" of Sparkle system. In more recent years, we added a "RAD layer", which are non-visual components that you can drop in the form and use them together to build a Sparkle server in an easier way than before.

Thus, there is not only TXDataServerModule now, but also a TXDataServer, which under the hood encapsulates the module.

And, as you said, there is a TSphinxServer and a TSphinxServerModule. Indeed, the "RAD layer" is easier to use and more straightforward, while the "Module layer" is non-visual, code-only and sometimes more complex to setup, but also more flexible. It's a fallback in case the "RAD layer" is not flexible enough.

Again, indeed, as you noted, the way to build a Sparkle server using an Apache module only uses the "Module layer". Then, in case you have a component of the "RAD layer" and want to use the "Module layer", you can simply use the method CreateModule from the component. This will create an instance of the "Module layer" with everything correctly setup based on the properties and events configured in the "RAD layer".

In summary, this is what you should do to add the module to dispatcher from an existing TSphinxServer instance you have previously configured:

  Server.Dispatcher.AddModule(SphinxServer1.CreateModule);

I hope this helps.