Thursday, September 1, 2011

SCA(Service Component Architecture)- Part 1

This is the part 1 in the series of articles that will cover the first three sections in the following aspects of SCA(Service Component Architecture):

  • What is SCA?
  • Is SCA better than JBI?
  • When do I use SCA?
  • How do I create an SCA Component/Composite?
  • How do I consume SCA?

What is SCA?
SCA can be plainly thought of as a way to create components and then assemble them so that they can work together. The Components that make up an application, can be built in Java or any one of the programming languages supported by SCA. A different technology, for instance, BPEL can be used as well.


Component   
The components vary in complexity, ranging from a simple java classes to ones which have multiple components including local or distributed Java classes, BPEL components etc. SCA defined a logical construct called composites which is nothing but an assembly of components. An application could consist of one composite or multiple. The components could be implemented using different languages or technologies if so desired. However, the components themselves have a few fundamental features:


  • Business logic exposed as Services. A Service is nothing but a set of operations that be invoked by a client.For instance a Java component might use an interface to describe the service.
  • Consuming other services as References
  • Property allows a component to read configuration or other initialization data.
  • binding can be thought of as a protocol to communicate with the service or reference and there can be multiple bindings per service/reference.


                                                           Figure 1: A component
SDO
SCA components can access data using SDO along with JDBC or JPA from a database. SDO is optional and can be thought of as the "DAO" pattern that Java defines. SDO might be the subject of another post later on.


Composite


An SCA composite is an ".composite" file which uses an XML-based format called the Service Component Definition Language (SCDL) to describe the components and their relationship.Example:




<composite name="myComposite">
   <component name="abc">
    ...
   </component>
   <component name="xyz">
      ...
   </component>
</composite>


                                                 Figure 2: A Composite




Domains
It's tough to describe domains in a way that most of us understand the word domain. Domains can be thought of as multiple SCA runtimes installed in local or distributed fashion. Since SCA doesn't define how distributed domains communicate with each other, its tough to describe what truly makes up a domain and how to map the definition of a composite to different domains? I may have not understood the specs correctly but t's probably not possible in SCA to have a composite cross multiple domains.  To me this is a significant limitation that I am hoping somebody clarifies.


(Maybe OSGI remote services can help here but that is the subject of a future post).




                                                Figure 3: An SCA Domain


Is SCA better than JBI?
It's like comparing apples to oranges ( Sorry, it's always fun to say this :-) ). To put it very succinctly JBI is what middleware vendors can use to provide or extend the runtime. SCA is what developers and assemblers can use to develop and deploy services ( as components and composites). So there is some overlap but not much. To me they are complementary and probably debated a lot because of Sun versus the "others" focus. Sun was focusing ( not sure if they still do) on JBI and the "others" were focusing on SCA. Probably what Sun is proposing has more to do with the middleware vendors themselves which the "others" are trying to avoid by focusing on the programming and component model instead of how the runtime is expected to behave.

   JBI would be more applicable for ESB vendors than component developers but I still think JBI has a role to play in Enterprise architectures because we do need more than a "point-to-point" model which SCA proposes. What if I have an SCA component that needs to broadcast a message(or event) which needs to be transformed differently for each of the target endpoints? It would be interesting to find out, how would this be implemented in SCA? Maybe we will have some "component" that either intercepts the point to point communication( is there such a thing in SCA?) or the message is actually directed to this mediator  (this breaks loose coupling?) which can then use BPEL, JMS or some other fan-out mechanism to broadcast this to the other components? Do I see an SCA+ Camel combination coming? :-)

I would hope that there is more synergy between JBI and SCA and this article does talk about one. It's from 2008, so I am not sure if this was updated or improved in recent time.

When do I use SCA?
SCA should be used to implement SOA when the organization doesn't already have any well-established SOA culture. Most often, the organization either has or tries to create a bunch of web services hoping that it would lead to SOA. Having web services is a good thing but it cannot lead to SOA unless the following criteria are met:

  • Loosely coupled. A web service that depends on another web service to finish it's processing is not SOA. It cannot reliably predict if the other service is running or even SHOULD be running. Web services should be truly independant of each other and no assumptions should be made as to their availability.
  • Composition of web services. Some framework or mechanism to exist that can combine, orchestrate or choreograph ( I won't go into the difference here :-) ) these services to implement business logic. Without effective coordination, having web services that are controlled by some inflexible and non-declarative piece of software is as bad as not having the web services in the first place.
  • Location Transparency: Again, services should be registered and located in a way that avoids violating the loosely coupled principle. It also means that there is a single mechanism to find and locate services and it's well established.
  • QoS, Governance: Without effective QoS and Governance support, web services are hard to maintain and grow. Do we know what is the impact of bringing down a particular service? Who can access a particular service? What are the Web service policy requirements and wow can a client satisfy these requirements?

SCA is a step forward in that direction as it has a bunch of specifications that can define how to create Service Oriented Business Applications ( SOBA). These specifications achieve the above SOA requirements and should be .  SCA has a programming model that allows one to use any of the supported programming languages ( C++, Java, BPEL etc).


Additionally, SCA provides the following things:
  • A platform neutral service component model that spans technologies and is not dependent on a particular language.
  • A client programming model to allow clients to access service components deployed in the runtime. SCA Developers can develop components using the various technologies they are familiar with, such as Enterprise Java Bean (EJBs), and use SCA to glue the components together.
  • Defines a standard model for defining dependencies between components. These dependencies are defined by wiring SCA components together using references.
  • Defines a standard deployment model for packaging components into a service module.
  • SCA has multiple bindings ( and not just web services) including JMS, BPEL, REST etc. I read about an interesting aspect of this when someone used SCA to define a "widget" composite/component in SCA and then provided the implementation of that Widget in HTML/JS. The Widget component was using the java components as references within the HTML/JS code. JSON and ATOM binding was used to expose the java components over the wire. A very interesting example of SCA indeed! I would have to locate this resource and link it here. If any one of you can find it, please let me know. 
  • An asynchronous programming model.


Caution:
An SCA runtime can implemented many different bindings including Web service, JMS, JCA, EJB etc. There is also an SCA service binding which is not defined by the spec and can be used only within a domain by an SCA runtime.The implementation of this binding type is not intended to be inter-operable. For interoperability the standardized binding types like web services should be used.

The opinions and statements in this communication are my own and do not necessarily reflect the opinions or policies of CA.

Friday, August 12, 2011

I am not against Enterprise Architecture but...

The term Enterprise Architecture has acquired a negative connotation in most enterprises. The idea that there is this one grand architecture that can solve all the business needs is not rooted in reality. How can an IT architecture solve the business problems in isolation? Is Technology good enough to solve problems without knowing what the problem is and how to measure what you solved?

I don't think so. For instance I was once involved with a project and all of us architects were showcasing the architecture to some external (theoretically unbiased) industry representatives. The demo was full of technical jargon and the latest buzzwords. The entire focus of the presentation was the architecture itself. Halfway, through the presentation, one of the industry representatives asked a simple question, "Where is business side to this? What exactly are you addressing?" There were no direct or quick answers. This was a wake up call that Architecture or Technology itself is not the solution. It is an enabler or a platform that can provide what the business is looking for now and what the business will need in a certain time from now and what the business might need in the future.

Most architects (and I have been guilty of this as well) want to sound informed and sometimes as a compulsion focus too much on the technical aspect of the architecture itself. The aspects are not required in the initial stages and the individual business components can be simplified to be architecture-agnostic. It is important to address the "might need" aspects of an enterprise but they shouldn't preclude simplicity.

An architecture design should be able to address the following things:

  • First and foremost, demonstrate how the architecture design addresses what is required now and what will be required in the future. Keep discussions on what might be required in the future for possibly the second iteration of architecture design. One doesn't have to stop thinking about this but essentially not over-analyze the future.
  • Which services will the architecture support(organizational unit or business unit services)?
  • Which services will the architecture provide( common platform or non-functional services)? 
  • Which components will the architecture support(organizational unit or business unit services or architectural )?
  • What is the essential contract of a service(if any)? What are we asking a service to be? A service typically doesn't change, it can be wrapped or adapted but the basic service doesn't change. 
  • What is the essential contract of a component(if any)? What are we asking a component to be? This is sometimes the hardest part because it involves changing the existing components or services in the way they exist in the enterprise. Also it is important to differentiate between components and services ( I will try to highlight this via  a separate blog post).
  • Allow business requirements to be traced down to some component or module or feature. We don't want to review architecture without understanding which business problems are being solved by which features. This mapping between business requirements and the architecture design elements most probably will exist in a separate artifact.
  • Resist the temptation to talk about how modules are packaged and deployed. Too many times we see an architecture design get bogged into deployment details. How a component is packaged and where it is deployed is not important at the initial stage. 

Based on the above, we will try to create a broad model that includes elements most commonly used in enterprise architectures. We will start with a simple enterprise architecture model almost resembling an applications architecture and then move to the added complexity of the enterprise. Let's assume that the architecture design is "growing" as the enterprise grows. The set of architecture guidelines that we establish will guide the designer and also allow them to "re-use" the model elements that suit their solutions. We will use elements from SOA, SCA, OSGI, JBI. We will reuse ESBs, MessageBrokers, EIP patterns. The model will aim to "assemble" these sometimes diverse elements and see if an enterprise can pick and choose the ones it needs without spending significant amount of time and money on trying to have a "grand" enterprise architecture.


So the subsequent posts will continue this thought and remember, a Software architecture is not an end to itself.

The opinions and statements in this communication are my own and do not necessarily reflect the opinions or policies of CA.

Thursday, August 11, 2011

Why we keep (re)inventing a good architecture design


Thanks to the proliferation of ideas and open source tools, good integration architecture is actually a very easy thing to achieve but has been so entangled in how organizations work and how ideas are shared that it ends up becoming a fairly messy exercise. If you are still unsure, try asking two architects to agree on the details of a solution.


This article will attempt to highlight some key points in an architecture that is supposedly common across all enterprises integrations. I believe an architect’s opinions heavily influence which architecture components he/she chooses and the below are based on mine.

Bus.
This can be considered the backbone of the enterprise. Without a good distributed communication mechanism, most projects will end up investing a significant amount of time (and money) discovering how distributed components interact remotely (or locally). The difficult thing however is to select and agree on a bus.

ESBs.
A good open source ESB should do the trick but this doesn’t preclude using a proprietary one as long as the fundamental loose coupling principles are followed (but please don’t add a “wrapper on top of an existing “wrapper” to make it look loosely coupled when in fact, the underlying API or technology is not mature enough to guarantee a stable interface.


Security
I will try to avoid details at this point because this might trigger a war with the security experts. Here are my basic expectations from security:
-          How are identity and authorization service providers configured and used?
-          Who has access to the deployments and passwords? Where are these defined?
-          Can I secure the entire communication, the entire message or just one fragment of the message?

      Container (lifecycle management)

     (coming soon)


     The opinions and statements in this communication are my own and do not necessarily reflect the opinions or policies of CA.