Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Communication from custom protocol


#1

Is it possible for a custom protocol to (in a thread safe manner) send a message to a TSmartInspect or TSiSession object? Dispatch allows you to send a custom command to the Protocol, but can there be communication the opposite direction?

For example: We are utilizing a custom protocol to log straight to a database. Sometimes the database server will send notifications that would be nice to add to all log sessions active (file, pipe, mem, etc.) or at least allow the main application to take some action. We could perform this outside of the scope of SmartInspect but that would require two connections to the database.

David Lambert


#2

Hello David,

There is currently no built-in support for this. I can certainly see how this can be useful, but I wouldn’t recommend integrating this functionality directly into your database protocol.

Besides the implementation complexity (especially threading and thread-safety related), a clean separation between your application and your logging layer should result in a simpler and much more maintainable solution. If you occasionally get some notifications from your database server, I would suggest doing this independently from SmartInspect and your custom protocol, even if this means opening a second connection to the server.