Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17971

camel-blueprint - Prototype scope doesn't work in bean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Information Provided
    • 3.14.2
    • None
    • camel-blueprint
    • None
    • java 11, karaf 4.3.6

    • Unknown

    Description

      I want to generate UUID. But uuidGenerator gets the same result every times.

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
                 xsi:schemaLocation="
                   http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                   ">
      
          <bean id="uuidGenerator" scope="prototype" class="java.util.UUID" factory-method="randomUUID"/>
      
          <camelContext id="example"
                        xmlns="http://camel.apache.org/schema/blueprint">
      
              <route>
                  <from uri="timer:foo?period=1000"/>
                  <setHeader name="UUID">
                      <simple>${bean:uuidGenerator.toString}</simple>
                  </setHeader>
                  <log message="UUID: ${headers.UUID}"/>
              </route>
      
          </camelContext>
      
      </blueprint> 

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            vborodina Valeria Borodina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: