Generic C++ for Networks
Client-server software has come a long way since the mid-90s. Service is now the industry buzzword and IT facilities all over the world are being upgraded to deliver on the promise of this new approach. The major driver for this is that IT infrastructure must now deliver services that facilitate business needs. This sounds daunting, but the concepts are fairly simple, and this article describes them by using examples drawn from the networking domain. It considers service requests, queues, executing service requests, and a short description of workflows. Finally, the queue structure and performance is briefly analyzed.
Service orientation is becoming the norm in IT as many organizations face into massive migration efforts. The concepts underlying much of this work are well established—only the terminology and some of the technology are different! I hope you’ll take away from this article a good base from which to look further at service-oriented software. These ideas are illustrated with respect to networking, but are also relevant to other domains. Along the way, I’ll describe my reasons for choosing a queue data structure for handling service requests.
Listing 1 shows a sneak preview of the type of code we’ll be looking at where a service request is
- Removed from the queue
Between steps 2 and 3, we could typically expect many other actions but I keep it simple in Listing 1 to illustrate the overall flow.
Listing 1 Implementation of a Service-Oriented Program
char serviceRequest1 = "Enable Link 1"; NMSServiceQueue* aServiceQueue = new NMSServiceQueue(); aServiceQueue->add(createQueueItem(serviceRequest1)); // Many more steps here QueueElementPtr anOperation = aServiceQueue->remove(); if (anOperation) printf("Removed a queue element: %s\n", anOperation->requiredOperation); delete anOperation->requiredOperation; delete anOperation;
First, let’s look a little at the background.