Adding global endpoints and data formats

Overview

Some routes may rely on shared configuration provided by global endpoints or data formats. You can add global endpoints and data formats to the project's routing context file using the route editor's Configurations view.

Accessing the global configurations options

To add global endpoints or data formats to your routing context file:

  1. Open your routing context file in the route editor.

  2. Click the Configurations tab at the bottom of the route editor's canvas to switch to Configurations view.

  3. Click Add to open the Create a new global element dialog.

    The options are:

Adding an endpoint

  1. In the Create a new global element dialog, select Endpoint.

  2. Click OK to open the Select component dialog.

    [Note]Note

    By default, the Select component dialog opens with the Show only palette components option enabled. To see all available components, disable this option.

    [Note]Note

    The Grouped by categories option groups components by type.

  3. In the Select component dialog, scroll through the list of Camel components to find and select the component you want to add to the context file, and then enter an ID for it in the Id field.

    In this example, we selected the JMS component and entered myJMS in Id.

  4. Click Finish.

    If necessary, open the Properties editor to edit the component's properties as appropriate for your project.

    The tooling autofills Id with the value you entered in the component's Id field in Step 3. It builds the uri (required field) starting with the component's schema (in this case, jms:), but you must specify the destinationName and the destinationType to complete the component's uri.

  5. To complete the component's uri, click Advanced > Path.

  6. In Destination Name, enter the name of the destination endpoint (for example, FOO.BAR). In Destination Type, enter the endpoint destination's type (for example, queue, topic), temp:queue, or temp:topic).

    [Note]Note

    For the JMS component, the destination type defaults to queue. This default value does not appear in the uri field on the Details page until you have entered a value in Destination Name (required field) .

    The Properties editor's Details and Advanced pages provide access to all properties available for configuring a particular component.

  7. For example, click the Consumer (advanced) tab.

    Enable the properties Eager Loading Of Properties and Expose Listener Session.

  8. Switch to Source view to see the code that the tooling added to the context file (in this example, a configured JMS endpoint), before the first route element.

  9. When done, save your changes by selecting File > Save on the menu bar.

Adding a data format

  1. In the Create a new global element dialog, select Data Format.

  2. Click OK to open the Create a global Data Format dialog.

    The data format defaults to avro, the format at the top of the list of those available.

  3. Open the Data Format drop-down menu, and select the format you want from the list (for example, xmljson).

  4. In Id, enter a name for the format (for example, myDataFormat).

  5. Click Finish.

    If necessary, open the Properties editor to display the data format's properties for editing.

  6. In the Properties editor, set property values as appropriate for your project; for example:

  7. Switch to Source view to see the code that the tooling added to the context file (in this example, a configured xmljson data format), before the first route element.

  8. When done, save your changes by selecting File > Save on the menu bar.

Deleting a global endpoint or data format

The procedure is the same whether removing an endpoint or data format previously added to the routing context.

  1. In Configurations view, select the global component—endpoint or data format—you want to delete.

    For example, deleting the data format myDataFormat previously added in Adding a data format:

  2. Click Delete.

    The global component myDataFormat disappears from Configurations view.

  3. Switch to Source view to check that the tooling removed the XML code from the routing context.

  4. When done, save your changes by selecting File > Save on the menu bar.

Editing a global endpoint or data format

The procedure is the same whether modifying the properties of an endpoint or data format previously added to the routing context.

  1. In Configurations view, select the global component—endpoint or data format—you want to edit.

    For example, editing the endpoint myJMS previously added in Adding an endpoint:

  2. Click Edit.

    In the Properties editor, modify the component's properties according to your project's needs.

  3. For example, open the Advanced > Consumer tab, and change the value of Concurrent Consumers to 2:

  4. Switch to Source view and check that the tooling added the property concurrentConsumers=2 to the routing context:

  5. When done, save your changes by selecting File > Save on the menu bar.

Related topics

Adding beans and configuration