Summary

This example again demonstrates how utilizing an IoC container allows sophisticated wiring of components while not requiring either the client or the server to know about it.

The latest example has totally rewired the original concept of the application simply by coding a different set of blue prints, i.e. IoC configuration. It also demonstrates how things are more powerful and sophisticated when using the pure Python IoC configuration. We were able to mix in code as well as parameters, which is much smoother than writing XML files.

Our application started off as a simple client calling a service. By rewiring it to use IoC, it allowed us to easily reconfigure things to run multiple copies of our service on multiple nodes, without having to change the core logic.

Our round robin dispatcher is admittedly very simplistic. A real production solution would require:

  • More sophisticated error handling to deal with things like remote access exceptions.
  • We would also need a way to grow new nodes and have them added to the list.
  • Perhaps by letting the dispatcher export itself, other services can latch on and find out what services are available.

Tip

Spring Python doesn't provide dispatchers, routers, and other types of components used to integrate systems together. Spring Integration (http://www.springsource.org/spring-integration) is a separate part of the Spring portfolio that brings these features to Java. Spring Python Remoting is a building block that in the future can be used to build a Spring Python Integration module.

We could spend countless hours refining our dispatcher. We can also focus on adding more features to our core business logic.

The important factor in all this as that we have demonstrated how Spring Python provides a non-invasive way to scale our original application far beyond what it was originally designed for.

In this chapter we have learned:

  • How Pyro provides a nice Python-to-Python remoting capability to easily create client-server applications
  • How Spring Python seamlessly integrates with Pyro so that your application doesn't have to learn the API
  • That it is easy to convert a simple application into a distributed one, all on the same machine
  • We rewired our application by splitting it up into parts, plugging in a round-robin queue manager, and running multiple copies of the server with no impact to our business logic

In the next chapter, we will use all of Spring Python's components to build a simple, scalable, and secure application with strong integrity.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.37.38