locked
VS 2005 DSL Tools - newbie question RRS feed

  • Question

  • Hi,

    I'm thinking of using DSL Tools to create "Configurator Utility" for a proprietary ESB (Enterprise Service Bus). This ESB is a rather young product developed by my colleagues, based on MSMQ. Currently it is set up and configured manually - by creating queues, installing "ESB Adapters" (that read from and write to these queues) on appropriate computers as Windows services, and creating/editing appropriate configuration files (xml). Just one scenario describing the current state of things:

    Imagine that some users copy zipped csv-files to some certain folder of computer "SrcDataStorage01". Our goal is to read these files as soon as they appear in this folder, extract data and store this data into a SQL Server database, running at computer "DataServer01". Any errors should be reported by e-mail to "administrator". When we solve this task by means of our ESB, we do the following (manually for the moment):

    • Install "FileGate Adapter" on computer "SrcDataStorage01" (as a Windows service). This adapter is capable of copying/moving files from one folder to another, unzipping them if needed.
    • Configure this adapter to point it to the proper source file path (say \\SrcDataStorage01\ZIPs\*.zip), to the proper target folder (where the unzipped csv-files will go, say \\SrcDataReader01\CSVs\) and specify the extension of extracted files to be copied (*.csv).
    • Install "ISAM Adapter" at computer "SrcDataReader01". This adapter is capable of reading csv/dbf/xls/html-files from disk, converting them to proprietary xml-format "ISAMReply" and placing this xml to a given queue.
    • Create MSMQ queue at computer "SrcDataReader01", say "SrcDataReader01\ISAM.Out".
    • Configure this adapter to point it to the proper folder containing csv-files (\\SrcDataReader01\CSVs) and to the proper output queue where it will place the "ISAMReply" xml ("SrcDataReader01\ISAM.Out").
    • Install "MSSQL Adapter" at computer "DataServer01". This adapter is capable of reading xml of a proprietary format "SqlCmdXml" from queue, converting it into a set of ADO.NET Commands and executing these Commands to store contents of this xml into a database. Besides, if the input queue message cannot be processed (invalid format etc), this adapter is capable of moving this messaqe to a "special" queue storing "bad messages".
    • Create two MSMQ queues at computer "DataServer01", say "DataServer01\MSSQL.In" and "DataServer01\MSSQL.Bad".
    • Configure this adapter to point it to the proper input queue containing "SqlCmdXml" ("DataServer01\MSSQL.In"), to the proper "bad messages" queue ("DataServer01\MSSQL.Bad") and specify the connection string to the target SQL Server.
    • Configure the "Router" to perform the following: read message from queue "SrcDataReader01\ISAM.Out", apply XSL transformation to this message (thus converting xml from "ISAMReply" format to "SqlCmdXml" format, the latter containing name of the stored procedure to be called), and place the result of the tranformation to queue "DataServer01\MSSQL.In". Besides, Router must read possible messages from queue "DataServer01\MSSQL.Bad" and move them to queue "MailServer\Mail.In" - this will result in sending e-mail alerts to "administrator".

    What I want is to create a "Configurator Utility" which will allow the following:

    • create a project with a graphical surface,
    • drop adapters at this surface as some shapes,
    • configure any adapter (e.g. by double-clicking at its shape) to specify computer, config location, log location etc,
    • create queues "inside" each adapter (input, output or both),
    • connect/reconnect these queues with a possibility to specify an XSL transformation for this connection,
    • add kind of explanations to all shapes and connectors.

    Besides, when I "compile" such project, I want to generate a "script" which will contain the following:

    • instructions (batch commands?) to install/reinstall/uninstall each adapter at a certain computer as a Windows service, the latter running under certain account,
    • instructions to create/recreate/remove each MSMQ queue at a certain computer,
    • ready-to-use configuration-files (xml) for all adapters involved,
    • ready-to-use configuration-file (xml) for Router (specifying interconnection of queues + possible XSL transformations etc).

    At last, I want to be able to do the following:

    • select any adapter (or the Router) and through some menu get access to its log and config (i.e. view contents of these files),
    • select any queue and through some menu get access to its current contents,
    • (ideally) have two kinds of groupings at the surface: "by computer" and "by adapter" (in other words - physical and logical groupings).

    I wonder if I can do that by means of DSL Tools, and if yes, then what shall I start with.
    I've already installed VS 2005 SDK (v.4) as it includes DSL Tools. I examined all types of DSL-related projects offered by the wizard but I do not see any exactly matching my needs. I guess I need to create all domain model from scratch.

    Thank you.

    Saturday, July 3, 2010 12:01 PM

Answers

  • Hi Comanche.

    The graphical part sounds like the "components" solution in DSL tools. But of course the problem with domain-specific languages is that you have to supply all the stuff that's related to your domain!

    From what you say about the configurator utility, I would start with the "components diagram" solution template, and then customize it. That provides shapes with input and output ports - which could represent your queues. Create two subclasses of the Component class, to represent your Router and Adapter, and set the Inheritance property of the Component class to Abstract. Add domain properties to these classes to represent the configuration variables. At run-time, the user would set these by selecting an adapter shape and then setting the configuration variables in the Properties window. The components diagram solution already contains relationships between output and input ports. Add a domain property to the relationship to represent the XSL transformation. Again, the user would set it by selecting the connector and using the Properties window. In each case, you can have the properties displayed and editable on the main surface if you like. 

    Generating the script is done by creating a text template that reads the model and spits out the installer commands, and separate templates to spit out the configuration files. Follow the style in the ".tt" examples in the debugging project.

    To generate a configuration file for each adapter and router, you need to use a little trick, because normally you only get one output file for each text template. Write a template that loops through the model writing out one big file, with the content for each element separated by a line like "++++filename+++". Then write a little utility that splits the file into its parts.

    To get access to the log of an item, you'd add a menu command. The MSDN library instructions for menu commands relate to the 2010 edition, but should work for 2005. There are also many blogs on this subject.

    HTH.


    - Alan -MSFT
    Sunday, July 4, 2010 9:15 AM

All replies

  • Hi Comanche.

    The graphical part sounds like the "components" solution in DSL tools. But of course the problem with domain-specific languages is that you have to supply all the stuff that's related to your domain!

    From what you say about the configurator utility, I would start with the "components diagram" solution template, and then customize it. That provides shapes with input and output ports - which could represent your queues. Create two subclasses of the Component class, to represent your Router and Adapter, and set the Inheritance property of the Component class to Abstract. Add domain properties to these classes to represent the configuration variables. At run-time, the user would set these by selecting an adapter shape and then setting the configuration variables in the Properties window. The components diagram solution already contains relationships between output and input ports. Add a domain property to the relationship to represent the XSL transformation. Again, the user would set it by selecting the connector and using the Properties window. In each case, you can have the properties displayed and editable on the main surface if you like. 

    Generating the script is done by creating a text template that reads the model and spits out the installer commands, and separate templates to spit out the configuration files. Follow the style in the ".tt" examples in the debugging project.

    To generate a configuration file for each adapter and router, you need to use a little trick, because normally you only get one output file for each text template. Write a template that loops through the model writing out one big file, with the content for each element separated by a line like "++++filename+++". Then write a little utility that splits the file into its parts.

    To get access to the log of an item, you'd add a menu command. The MSDN library instructions for menu commands relate to the 2010 edition, but should work for 2005. There are also many blogs on this subject.

    HTH.


    - Alan -MSFT
    Sunday, July 4, 2010 9:15 AM
  • Hi Alan.

    Thank you for such a great answer!

    I will try to use the approach you describe. One little question more: is the number of "ports" limited? I mean, can there be more than 1 input and 1 output port? Our ESB allows existence of adapters using arbitrary number of queues (most common situation - 1 input queue and 2 output queues).

    Monday, July 5, 2010 8:15 AM