A constant holding the smallest positive nonzero value of type (oracle java)
0x0.0000000000001P-1022; // 4.9e-324
two types of messaging models
for an annotation to be accessible at runtime it has to be annotated as follows
@Retention(RUNTIME)
How to access annotations
Method[] methods = cls.getMethods();
for(int i=0;i<methods.length';i++){
Annotation[] annos = methods[i].getAnnotations();
// the annos[] can be type casted to the annotation and then used.
}
Internal Exception: java.sql.BatchUpdateException: ORA-01691: unable to extend lob segment DEV_SOAINFRA.SYS_LOB0000073615C00017$$ by 1024 in tablespace DEV_SOAINFRA
Error Code: 1691
at oracle.integration.platform.instance.store.DOStore.put(DOStore.java:177)
at oracle.integration.platform.instance.error.DOObjectExceptionHandler.recover(DOObjectExceptionHandler.java:41)
at oracle.integration.platform.instance.error.FileBackedExceptionHandler.recover(FileBackedExceptionHandler.java:301)
at oracle.integration.platform.instance.error.FileBackedExceptionHandler.run(FileBackedExceptionHandler.java:355)
at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:106)
at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
Caused by: Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.3.0) (Build 100323)): oracle.toplink.exceptions.DatabaseException
Solution
Increase the table space of DEV_SOAINFRA
Binding Components | Connectivity between soa composite and external world. Service Binding : incoming Reference Binding: out going |
Service Infrastructure | Internal message transport |
Service Engines | Host the business logic or processing rules of the service components |
UDDI and MDS | services are stored in MDS and published in UDDI |
SOA Archive | its a deployment unit. |
Wires | connect all the above components |
Open launch configuration and add the following to the VM arguments.
-Xms768m -Xmx1024m -XX:MaxPermSize=512m
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions>
<wsdl:types>
</wsdl:types>
<wsdl:message name="messageName">
</wsdl:message>
<wsdl:portType name="portName">
</wsdl:portType>
<wsdl:binding name="soapBinding" type="impl:portTypeName">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/protocol"/>
</wsdl:binding>
<wsdl:service name="serviceName">
<wsdl:port binding="soapBinding" name="HelloWorld">
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<soap:binding transport indicates the protocol used for sending the soap request
http,snmp,smtp,ftp etc.
public class HelloImpl {
// says hello
public String sayHello() {
return "Hello world";
}
// adds two numbers
public int addNumbers(int a, int b) {
return a + b;
}
}
6. Select the methods of the java class to be exposed as webservice operations in this case , sayHello and addNumbers operations
![]()
7. Start the server clicking the start button in the next window and then click next.
8. click next and Finish, which will open the Web services Explorer
Adding A Service mix drools
File1 <?xml version="1.0" encoding="UTF-8"?> <test id="1"> this file matches rule 1 </test> File2 <?xml version="1.0" encoding="UTF-8"?> <test id="2"> this file matches rule 2 </test> File3 <?xml version="1.0" encoding="UTF-8"?> <test id="3"> this file matches rule 3 </test> Then the D-rools are configured like this.
the above rules check the id attribute present in the xml based on that
they send the messages to one of file_sender1,file_sender2,file_sender3.
package org.apache.servicemix.drools import org.apache.servicemix.drools.model.Exchange; global org.apache.servicemix.drools.model.JbiHelper jbi; rule "Route to target1" when me : Exchange( status == Exchange.ACTIVE, $in : in != null ) eval( $in.xpath("/test/@id = 1") ) then jbi.route( "service:http://servicemix.apache.org/bytes/file_sender1" ); end rule "Route to target2" when me : Exchange( status == Exchange.ACTIVE, $in : in != null ) eval( $in.xpath("/test/@id = 2") ) then jbi.route( "service:http://servicemix.apache.org/bytes/file_sender2" ); end rule "Route to target3" when me : Exchange( status == Exchange.ACTIVE, $in : in != null ) eval( $in.xpath("/test/@id = 3") ) then jbi.route( "service:http://servicemix.apache.org/bytes/file_sender3" ); end
File Poller
<file:poller service="bytes:file_poller" endpoint="file-poller" targetService="bytes:serviceNameDR" targetEndpoint="drools" file="file:C:/SOURCE">
<file:sender service="bytes:file_sender1" endpoint="file-sender" directory="file:C:/DESTINATION1" /> <file:sender service="bytes:file_sender2" endpoint="file-sender" directory="file:C:/DESTINATION2" /> <file:sender service="bytes:file_sender3" endpoint="file-sender" directory="file:C:/DESTINATION3" />
The default template generated by the maven for service mix drools su has some errors like
Caused by: org.drools.CheckedDroolsException: There were errors in the rule source:
Rule Compilation error : [Rule name=Unspecified id, agendaGroup=MAIN, salience=0, no-loop=false]
org/apache/servicemix/drools/Rule_Unspecified_id_0.java (8:292) : in cannot be resolved
it says in Cannot be resolved, the way the default router.drl was generated needs to be corrected,
to access the in Message it has to be prefixed with “$” so it should be $in
rule "Route to target1"
when
me : Exchange( status == Exchange.ACTIVE, $in : in != null )
eval( $in.xpath("/bar:test/@id = 1") )
then
jbi.route( "bytes::file_sender1" );
end
Scenario: FilePoller = > EIP Pipeline => {transformer is the bean below} => File Sender { target }
the exception was at the bean. Complete Exception is below
javax.jbi.messaging.MessagingException: Out not supported
at org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setMessag(MessageExchangeImpl.java:357)
at com.bytes.tutorial.MyBean.onMessageExchange(MyBean.java:46)
at org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:230)
at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:217)
at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
at org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
at org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchangeSyncLifeCycleWrapper.java:60)
at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:632)
at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:185)
at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
public void onMessageExchange(MessageExchange exchange)
throws MessagingException {
System.out.println("Received exchange: " + exchange);
System.out.println("getPattern exchange: " + exchange.getPattern());
System.out.println("getStatus exchange: " + exchange.getStatus());
System.out.println("Role exchange: " + exchange.getRole().toString());
NormalizedMessage in = exchange.getMessage("in");
exchange.setMessage(in, "out");
channel.send(exchange);
}
is changed to have a check
if (exchange.getStatus() == ExchangeStatus.DONE)
return;
or
if (exchange.getStatus() == ExchangeStatus.ACTIVE){
System.out.println("Received exchange: " + exchange);
System.out.println("getPattern exchange: " + exchange.getPattern());
System.out.println("getStatus exchange: " + exchange.getStatus());
System.out.println("Role exchange: " + exchange.getRole().toString());
NormalizedMessage in = exchange.getMessage("in");
exchange.setMessage(in, "out");
channel.send(exchange);
}
<dependency>the XBEAN.XML generated will have all examples of the patterns that can be used.
<groupId>com.bytes.tutorial</groupId>
<artifactId>eip-su</artifactId>
<version>1.01</version>
</dependency>
<eip:pipeline service="bytes:eipPipeBean" endpoint="endpoint">
<eip:transformer>
<eip:exchange-target service="bytes:myBeanService" />
</eip:transformer>
<eip:target>
<eip:exchange-target service="bytes:file_sender" />
</eip:target>
</eip:pipeline>
As show above this EIP pipeline is configured in such a way that
the bean “bytes:myBeanService” processes the data and gives it to the bytes:file_sender .
that should take care of writing the files to that directory.
find the sample code here => Example
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-core</artifactId>
<version>${servicemix-version}</version>
<scope>provided</scope>
</dependency>
package com.bytes.tutorial;
import javax.annotation.Resource;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.InOnly;
import javax.jbi.messaging.InOut;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessageExchangeFactory;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.namespace.QName;
import org.apache.servicemix.MessageExchangeListener;
import org.apache.servicemix.jbi.messaging.NormalizedMessageImpl;
import org.apache.servicemix.jbi.util.MessageUtil;
public class MyBean implements MessageExchangeListener {
@Resource
private DeliveryChannel channel;
public void onMessageExchange(MessageExchange exchange)
throws MessagingException {
if (exchange.getStatus() == ExchangeStatus.ACTIVE)
{
System.out.println("Received exchange: " + exchange);
System.out.println("getPattern exchange: " + exchange.getPattern());
System.out.println("getStatus exchange: " + exchange.getStatus());
System.out.println("Role exchange: " + exchange.getRole().toString());
NormalizedMessage in = exchange.getMessage("in");
exchange.setMessage(in, "out");
channel.send(exchange);
}
}
}
<bean:endpoint service="bytes:myBeanService" endpoint="endpoint" bean="#myBean"/>
<bean id="myBean" class="com.bytes.tutorial.MyBean"/>
Configure the bean as the above service so that it can be called from the EIP Pipeline.
we will see in the next post how to integrate the file poller the sender and this bean which will process the data in between.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bytes.tutorial</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>bytes</name>
<url>http://servicemix.org</url>
<modules>
<module>bytes-sa</module>
</modules>
</project>
<file:poller service="bytes:file_poller" endpoint="file-poller"
targetService="bytes:file_sender"
targetEndpoint="file-sender"
file="file:C:/SOURCE">
<file:sender service="bytes:file_sender"
endpoint="file-sender"
directory="file:/D:/DESTINATION">
name of the sender service should match the targetService of the poller
configure the directory where the files should be sent “directory”
do an mvn install and then go to the service assembly folder
and pick the jar file from the target and deploy in the hotdeploy
folder of service mix and see the MAGIC.
download the sample here