Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Maven users will need to add the following dependency to their pom.xml for this component:

Code Block
xml
xml
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-javaspace</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

...

You can append query options to the URI in the following format, ?option=value&option=value&...

Options

Name

Default Value

Description

spaceName

null

Specifies the JavaSpace name.

verb

take

Specifies the verb for getting JavaSpace entries. The values can be: take or read.

transactional

false

If true, sending and receiving entries is performed within a transaction.

transactionalTimeout

Long.MAX_VALUE

Specifies the transaction timeout.

concurrentConsumers

1

Specifies the number of concurrent consumers getting entries from the JavaSpace.

templateId

null

If present, this option specifies the Spring bean ID of the template to use for reading/taking entries.

Examples

Sending and Receiving Entries

No Formatcode
//Sending sending route
from("direct:input")
    .to("javaspace:jini://localhost?spaceName=mySpace");

//Receiving receiving Route
from("javaspace:jini://localhost?spaceName=mySpace&templateId=template&verb=take&concurrentConsumers=1")
    .to("mock:foo");

In this case the payload can be any object that inherits from the Jini Entry type.

...

The JavaSpace component has been tailored to work in combination with the Camel bean component. It is therefore possible to call a remote POJO using JavaSpace as the transport:

Code Block

// client side
No Format
from("direct:input")
    .to("javaspace:jini://localhost?spaceName=mySpace"); 

//Client server side

from("javaspace:jini://localhost?concurrentConsumers=10&spaceName=mySpace")
    .to("pojomock:pojofoo"); //Server side

In the code there are two test cases showing how to use a POJO to realize the master/worker pattern. The idea is to use the POJO to provide the business logic and rely on Camel for sending/receiving requests/replies with the proper correlation.

Options

...

Name

...

Default Value

...

Description

...

spaceName

...

null

...

Specifies the JavaSpace name.

...

verb

...

take

...

Specifies the verb for getting JavaSpace entries. The values can be: take or read.

...

transactional

...

false

...

If true, sending and receiving entries is performed within a transaction.

...

transactionalTimeout

...

Long.MAX_VALUE

...

Specifies the transaction timeout.

...

concurrentConsumers

...

1

...

Specifies the number of concurrent consumers getting entries from the JavaSpace.

...

templateId

...

null

...

.

Include Page
CAMEL:Endpoint See Also
CAMEL:Endpoint See Also