MicroStrategy ONE

Overview of Tasks

In general terms, a task is a well-defined operation in MicroStrategy Web that is packaged as a Web-accessible service. Tasks are intended to be very responsive and remotely accessible to a web client in many forms, including an HTTP request to a server or a Web Service using the SOAP protocol.  Examples of tasks include logging in or out, executing a report or document, adding a visualization, deploying a widget, and performing a variety of mobile-related actions.

MicroStrategy provides a set of pre-built tasks that are already registered in the task registry and available for use out-of-the-box. In addition to these out-of-the-box tasks, you can use the Web Customization Editor to build custom tasks—using XML, Java code, or a combination of the two—and register them. Once a task is registered, it is available for use by any client anywhere. It is included in the list of available tasks in the Web Customization Editor and on the Tasks page of the Task Processor Administrator application.

Custom tasks can be built programmatically, as a Java class, or generated automatically from an XML file that describes the behavior of the task. Regardless of how they are built, all tasks perform two essential activities:

  • Data collection

    Data collection is the process of using the supplied task parameters to dynamically generate data, typically through one of the many MicroStrategy Web APIs. Data can also be collected through the use (or reuse) of a bean event handler. The amount of data collected (and serialized) is typically smaller than that of an entire Web page. In particular, the amount of data to collect is the minimum amount required to fulfill an immediate user request.  

  • Content generation

    Content generation is the process of serializing the data that is collected into a form that can be consumed by the caller. Some of the most common formats for serializing this data are XML and JSON (JavaScript Object Notation). All generated content is contained in a Markup Output object instance.

Tasks are supported by the Task Infrastructure, MicroStrategy's service-oriented architecture (SOA). They are used internally by MicroStrategy for such important product features as Flash dashboards, the FlexBuilder-based Visualization SDK, and MicroStrategy Mobile.

There are many compelling reasons to use tasks.

  • Tasks are designed to work with highly interactive web applications such as those based on Ajax or Adobe Flex technologies.  

  • Tasks are reusable and parameter-driven.  

  • Tasks use the existing Web API, taking advantage of the MVC paradigm that disconnects the data (bean) from the view (style). This is beneficial for applications that require a different view of the data.  

  • A complete set of out-of the-box functionality is already exposed as pre-built tasks.  

  • A complete API exists, with public methods that can be used to create tasks quickly.

Technical overview of tasks

In its simplest form, a task is a remotely accessible component that generates a small amount of data, based on a set of operating parameters. In more specific terms, tasks are Java objects that receive some number of inputs (known as “task parameters”), perform some custom data collection, and generate content. Each task has a unique identifier which defines it within the framework. This identifier may be specified in an HTTP request or used programmatically to invoke it. A task also has metadata that describes the purpose of the task as well as the nature of its parameters. This metadata can be used in applications to present the task in human readable format.

Tasks are designed to provide rapid feedback of only the data needed to fulfill a request. To address the stringent performance requirements, a task is inherently stateless—a single instance is used to fulfill all concurrent requests. A single object contains all per-request data. The overhead associated with selecting a task instance and processing an incoming request is very low. This ensures that no CPU cycles are wasted on unnecessary calls.

Tasks do not exist in a void, but within a well defined workflow. The Task Processor implements this workflow. It ensures that task objects are reused (or created if necessary). It packages all per-request data into a context object (called a Task Request Context object) so that tasks may remain stateless. To aid in the creation of tasks, the Task Processor interacts with a specialized Task Factory. A Task Factory brings a task to life and facilitates any necessary one-time initialization (and destruction) associated with the task. A single Task Factory employs a specific way to create a task instance. Other Task Factories may employ other means. For this reason, Task Factories may be organized in a “chain” so that if the first factory cannot satisfy the request, subsequent Task Factories can be invoked.