Apache Camel的split使用示例

用法一:


	
	
	
		
		${in.header.ids}
		
	


	
	
	
		
		
		
	


	
	
	
		
		
		
	


	
	
	
		
		${in.body}
		
	

用法二:


	
	
	
		
		
	


	
	
	
		
		
	


com.lala.util.Split.java

package com.lala.util;

import java.util.Arrays;
import java.util.List;

import org.apache.camel.Body;
import org.apache.camel.Header;

import com.lala.bean.Role;

public class Split
{
	public List split1(@Body Role role)
	{
		return role.getUsers();
	}
	
	public List split2(@Header(value = "ids") String ids)
	{
		return Arrays.asList(ids.split(","));
	}
}

package com.lala.bean;

import java.util.List;

public class Role 
{
	private List users;
	public List getUsers() {
		return users;
	}
	public void setUsers(List users) {
		this.users = users;
	}
}


你可能感兴趣的:(Apache,Camel实战,Apache,Camel实战,camel)