samedi 9 mars 2019

windows services, ConcurrentQueue and project design

i am trying to build a project where i i have : 1. windows service, 2. on start created a StartProcess and EndProcess class 4. use web interface to show ConcurrentQueue status

the web interface should be able to see both of the ConcurrentQueue (used to display data over http, like done here c-sharp-windows-service-expose-web-interface)

public class StartProcess
{
    private readonly MessageComposer _messageComposer;
    private readonly ILog _log;
    private static dynamic config = new Configuration();
    private readonly SmppClient _client;

    public  Sender()
    {}
//read data to ConcurrentQueue 
//pull data from ConcurrentQueue 
//when done put to another ConcurrentQueue 
}

in the end of process

public class EndProcess
{
    private readonly MessageComposer _messageComposer;
    private readonly ILog _log;
    private static dynamic config = new Configuration();


    public  Sender()
    {}
//read data to ConcurrentQueue 
//process data
//write to db 
}

web interface method

 public Stream test(string x1)
    {

        if (WebOperationContext.Current != null)
            WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";
        string template = "<html><body><h1>System Status</h1><div>{0}</div><div></div></body></html>";
        string html = string.Format(template, cqIn.Count);
        html = string.Format(html, cqOut.Count);
        byte[] htmlBytes = Encoding.UTF8.GetBytes(html);
        return new MemoryStream(htmlBytes);
    }

what is the correct design to build a solution for this?

Aucun commentaire:

Enregistrer un commentaire