View Full Version : Using Dream for REST API of a stateful service
06-24-2008, 01:16 PM
I have a stateful daemon to which I'd like to add a REST api to check status, and allow some manipulation. Looking at the various examples, it seems that Dream is always hosted. Is there a way to just embed the REST engine so that I can have the requests running in the same process with access to the daemon's state objects?
06-25-2008, 02:15 PM
You can run Dream inside any process. It doesn't have to be hosted independently, although that's the most common configuration.
06-25-2008, 04:06 PM
I haven't dug into the architecture, but going through the embedded example, it seemed that it just embedded the host, but still dynamically loaded the service. Is there a way to host a service class already in the current appdomain? And once a service is loaded, can i access the instance, so that I can wire it up to my daemon's message pump?
Ideally, I'd like to create the service via my existing IoC infrastructure and then just hand it to DreamHost to be hosted.
07-01-2008, 08:25 PM
Hmm, yeah, I don't think that will work. The DreamHost assumes that it's responsible for creating and destroying the service. So you can't just hook up an existing instance. However, you could create a "facade" service that is created by DreamHost and then connects to your actual instance. The way to create the connection would be done by passing some information in the config XML document that enables the service to locate your existing instance.
Powered by vBulletin™ Version 4.1.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.