460 likes | 554 Views
Introduction to Etch. Scott Comer Technical Leader sccomer@cisco.com. Welcome. Introduction to Etch what it is how to use it to build a network service where it is going. What is a network service?. Messages and formats Action: query or control; Event
E N D
Introduction to Etch Scott Comer Technical Leader sccomer@cisco.com
Welcome • Introduction to Etch • what it is • how to use it to build a network service • where it is going
What is a network service? • Messages and formats • Action: query or control; Event • Definitions / abstractions / rules • Players / authorization / transports
What is Etch? • Network service description language • Compiler • Runtime
Why Etch? • Language independence • Transport independence • Small and quick – high performance • Symmetric
Relationship to Cisco Unified Application Environment • Application environment is a federation of services • Formalized APIs • Programmable and extensible • Enhances the Developer Experience
Demos Hello World
Hello World C# Demo • Create etch interface • Generate server and client code • Implement the hello message in the server • Call the hello message from the client • Build the server and client • Run the server and client
Client Listener Server Sequence Diagram Listen
Client Listener Server Sequence Diagram Listen Connect
Client Listener Server Sequence Diagram Listen Connect Create Server Session
Client Listener Server Sequence Diagram Listen Connect Create Server Session Sends Hello To Server
Client Listener Server Sequence Diagram Listen Connect Create Server Session Sends Hello To Server Disconnect
Summary Hello World C# Demo • Etch generated most of code. • Generated code does all of the plumbing. • Developer only needs to be concerned with implementing and using the interfaces. • Less than 5 minutes to build a simple client / server application.
Hello World Java Demo • Show using Etch in Eclipse • Start with existing demo • Add client callback
Summary Hello World Demo • Java has similar experience to C# • Message sending looks just like procedure calls • Generated codes may be easily integrated
Etch Language • Messages • int add( int x, int y ) • Native types • boolean, byte, short, int, long, float, double, string, object, List, Map, Set, arrays of those things • Structured data types • struct Point( double x, double y, double z ) • External data types • @Extern( java, “com.company.User”, … ) • extern User
Etch Language, part 2 • Constants • const int ZERO = 0 • Enumerations • enum PrimaryColor ( RED, GREEN, BLUE ) • Exceptions • exception LoginFailed( int code, string msg )
Etch Language, part 3 • Attributes • @Direction( which ) – server, client, both • @Oneway • @Timeout( millis ) • @Authorize( method, args … )
Etch Language, part 4 • Formal Comments • /** • * Adds two numbers together. • * @param x the first number. • * @param y the second number. • * @return the sum of the arguments. • */ • int add( int x, int y )
Etch Language, part 5 • Mixins • service Foo • { • mixin Bar • mixin Baz • }
Etch Language Example module com.acme service GeoFun { • const double DEFAULT_HOW_FAR = 10 // miles • const int DEFAULT_NUM_LANDMARKS = 20 • struct Point( double latitude, double longitude ) • struct Landmark( Point where, string description ) • void addLandmark( Landmark landmark ) • void removeLandmark( Landmark landmark ) • Landmark[] searchLandmarks( Point where, double how_far, • int count ) }
Nitty Gritty Details Compiler, architecture
Etch Compiler • Written in Java (runs anywhere) • Uses Templates (easier to port) • Bindings (java, csharp, …)
Etch Process Etch Compiler Etch Source Interface ValueFactory Remote Base Stub Main Impl Helper
Etch Inheritance Interface Remote Base Impl
Main Main Remote Remote Transport Transport Impl Impl Stub Stub Etch Architecture
Main Main Remote Remote Transport Transport Impl Impl Stub Stub Etch Architecture
Main Main Remote Remote Transport Transport Impl Impl Stub Stub Etch Architecture
Main Main Remote Remote Transport Transport Impl Impl Stub Stub Etch Architecture
Main Main Remote Remote Transport Transport Impl Impl Stub Stub Etch Architecture
Runtime • Message model • Compiler support • Transport • Utilities
Message Model • Representation (type, fields & values) • Meta data • Generated code is transport independent
Transport • URI specification • Manages session • Moves messages • Message format is generic or transport specific • (binary, xml, soap, …)
Transport, part 2 • Transport services and properties • Authentication, session, logging, rate control, filtering • Protocols • Now: TCP, TLS • Planned: JSON, UDP, AES, SOAP • Extensible • JMS, REST, …
Filter Chain auth session log keep alive Transport, part 3 Remote Stub Value Factory Messagizer Mailbox Manager Packetizer Security Stream
More Demos Distributed Map
Distributed Map Demo • Provides access to a shared Map • Add notification when values change • Example of session management
Roadmap • JSON, Python, C, Ruby bindings • More transports and transport modes • Web Services Gateway • Better Integration with IDEs, Maven
Where from here? • Distribution: • http://developer.cisco.com/web/cuae/etch • Source • https://etchproj.svn.sourceforge.net
Summary • Etch is a powerful tool that formalizes APIs used to access and extend Cisco Unified Application Environment • Etch automates many tedious and distracting tasks • Etch may be used in your own projects, and embedded in your own systems.