Skip to main content

Implementing Messaging APIs

  • Chapter
  • First Online:
Creating Maintainable APIs
  • 1183 Accesses

Abstract

XML and JSON are language-independent and generic message formats, but they lag behind binary formats in efficiency. When you need to craft a system capable of processing high volumes of data, switching to a binary representation is a viable approach.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 49.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The RPC style tends to introduce more coupling between clients and servers than the REST approach. This is why RPC services might efficiently flourish only inside corporate boundaries. Once again, I’m not stating that they cannot be successful in general, just that they are better suited for internal use. On the other hand, there is no justifiable reason to stick to REST, when RPC could deliver better performance for such inner systems.

  2. 2.

    You can visit Avro’s web site for extensive documentation at http://avro.apache.org . Avro does support JSON serialization (besides a binary one), but this is more useful for debugging purposes than in a production setup. REST services can also use this possibility, but using the bare application/json as a media type isn’t advisable in a Level 3 REST service. All in all, this is the reason Avro is concomitant to a binary encoding of data.

  3. 3.

    When using a stateless transport in Avro, which boils down to HTTP, each request/response cycle is prefixed with a handshake. During this period a schema is exchanged, too. Therefore, you might want to use this kind of a transport in cases when the actual message payload is much larger than the schema alone. You might also want to reduce the number of such request/response cycles.

  4. 4.

    Something we can do with XSL on XML documents (for more details visit http://www.w3schools.com/xsl/ ).

  5. 5.

    Often developers choose a simple timestamp (e.g., the creation time in UTC) as an identifier. In an asynchronous distributed system, there is no global clock. Any timestamp could be drifted away from the “current” time. It could happen that the same service would regenerate timestamps, if its clock was moved backward by an NTP daemon (it will try to slow down the fast node, but might even set the time backward in an extreme case). The major problem arises when such timestamps are also used for reasoning about ordering of events.

  6. 6.

    You can use the isReservedMeta method of the DatumFileWriter class as a sanity check, whether or not your meta field is already reserved by Avro.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Ervin Varga

About this chapter

Cite this chapter

Varga, E. (2016). Implementing Messaging APIs. In: Creating Maintainable APIs. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2196-9_11

Download citation

Publish with us

Policies and ethics