Questo contenuto non è disponibile nella lingua selezionata.

Chapter 25. Editing running routes


Overview

You can experiment with changes to a running route without changing your project’s routing context.

To do so:

  • In the JMX Navigator view, enable the Edit Routes option on the running routing context.

    This opens an in-memory model of it — Remote CamelContext:<camelContextId> — in the route editor.

  • In the route editor, make your changes to the in-memory model of the routing context. At the same time, you can set breakpoints on relevant nodes to use the Camel debugger and all of its features.

    You can edit the in-memory model to add, remove, or rearrange nodes; to add or remove properties of existing nodes; and to modify property values set on existing nodes. You must save changes made to the in-memory model to update the running context and to see results in the Debug perspective if you set breakpoints.

  • In the JMX Navigator view, drop messages on the running routing context, or wait for messages to arrive from a timer, ActiveMQ, file, or other continuous input node.
  • In the Debug perspective, evaluate results and use the Camel debugger to gain deeper insight into your routing context.

Modifying a running route and evaluating results

  1. In the JMX Navigator view, select the routing context that contains the routes you want to edit.
  2. Right-click the selected routing context to open the context menu, and select Edit Routes.

    The route editor opens an in-memory model of the routing context, Remote CamelContext:<contextId>, and displays all routes in the context, for example:

    CanvasPalette
    Note

    <contextId> is the ID of the camelContext element in the project’s routing context .xml file. In this example, which is based on the Fuse Content Based Router built-in template, the ID is cbr-example-context.

  3. Edit the route as described in Chapter 2, Editing a routing context in the route editor, then select File Save to save the changes you made to the in-memory model and to update the running routing context.
  4. Set breakpoints on the relevant nodes as described in Chapter 13, Setting Breakpoints.
  5. In the JMX Navigator view, drop a message on the running routing context’s input node.

    If your project does not include test messages, you can create them as described in Section 22.1, “Creating test messages for route tracing”.

  6. Click Yes to confirm the switch to the Debug perspective.
  7. In the Camel debugger, step the message through the breakpoints as you normally would (see Chapter 14, Running the Camel Debugger) to see the results your changes generated.

    The Camel debugger behaves the same in Edit Routes mode as in normal debug mode, so you can use any of the Camel debugger’s features while a message is transiting the routing context.

    Note

    When a message reaches the end of the routing context, the debugger is suspended. To continue debugging, switch back to the Fuse Integration perspective and drop another message on the input node in the JMX Navigator view. Each time you do so, the tooling asks you to confirm the switch to the Debug perspective.

    Note

    During a route editing session, it is possible to lose the connection to the running routing context. If this happens, then in the JMX Navigator view, you would see something like this: Local Processes maven[xxxx][Disconnected]. To continue the session, you must reconnect to the running routing context, select it in the JMX Navigator view, and then re-select Edit Routes.

Terminating the route editing session

  1. In the Debug perspective’s Debug view, select the Remote Camel Debug - camelContext--<contextId>--xxxxxxxxxxxxxxxxxx.xml [Remote Camel Context] thread, and then click Terminate button on the menu bar to terminate the debugging session.
  2. On Console view’s menu bar, click Terminate button to terminate the routing context.
  3. If you want to clear console output, click clear co on the Console view’s menu bar.
  4. Switch to the Fuse Integration perspective, and in the route editor, click close on the Remote CamelContext:<contextId> tab to close the in-memory model of the routing context file.
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.