-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-4: Added example processor that is in fact a Spring bean
- Loading branch information
Showing
4 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
// Place your Spring DSL code here | ||
beans = { | ||
myProcessor(org.example.MyProcessor) { | ||
textProviderService = ref("textProviderService") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
class ExampleRoute { | ||
def textProviderService | ||
This comment has been minimized.
Sorry, something went wrong. |
||
def configure = { | ||
// example: | ||
// from('seda:input').to('stream:out') | ||
from('activemq:example').to('bean:exampleService?method=receive') | ||
from('activemq:example').processRef("myProcessor").to('bean:exampleService?method=receive') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.example | ||
|
||
class TextProviderService { | ||
String getText() { | ||
"This is a text from service" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.example; | ||
|
||
import org.apache.camel.*; | ||
|
||
public class MyProcessor implements Processor { | ||
private TextProviderService textProviderService; | ||
|
||
public void process(Exchange exchange) throws Exception { | ||
String body = exchange.getIn().getBody(String.class); | ||
exchange.getOut().setBody("Processed: " + textProviderService.getText() + " - org: " + body); | ||
} | ||
|
||
public TextProviderService getTextProviderService(TextProviderService textProviderService) { | ||
return this.textProviderService; | ||
} | ||
|
||
public void setTextProviderService(TextProviderService textProviderService) { | ||
this.textProviderService = textProviderService; | ||
} | ||
} |
Please dissregard this declaration - it was a mistake...