Apache OFBiz 学习笔记 之 服务引擎 一
<!-- Service Engine Configuration -->
<engine name="entity-auto" class="org.ofbiz.service.engine.EntityAutoEngine"/>
<engine name="group" class="org.ofbiz.service.group.ServiceGroupEngine"/>
<engine name="interface" class="org.ofbiz.service.engine.InterfaceEngine"/>
<engine name="java" class="org.ofbiz.service.engine.StandardJavaEngine"/>
<engine name="simple" class="org.ofbiz.minilang.SimpleServiceEngine"/>
<engine name="script" class="org.ofbiz.service.engine.ScriptEngine"/>
<!-- Engines that can be replaced by the generic script engine -->
<engine name="bsh" class="org.ofbiz.service.engine.BeanShellEngine"/>
<engine name="groovy" class="org.ofbiz.service.engine.GroovyEngine">
<parameter name="scriptBaseClass" value="org.ofbiz.service.engine.GroovyBaseScript"/>
</engine>
<engine name="jacl" class="org.ofbiz.service.engine.BSFEngine"/>
<engine name="javascript" class="org.ofbiz.service.engine.ScriptEngine"/>
<engine name="jpython" class="org.ofbiz.service.engine.BSFEngine"/>
<!-- -->
<engine name="route" class="org.ofbiz.service.engine.RouteEngine"/>
<engine name="http" class="org.ofbiz.service.engine.HttpEngine"/>
<engine name="jms" class="org.ofbiz.service.jms.JmsServiceEngine"/>
<engine name="rmi" class="org.ofbiz.service.rmi.RmiServiceEngine"/>
<engine name="soap" class="org.ofbiz.service.engine.SOAPClientEngine"/>
<engine name="ofbiz-workflow" class="org.ofbiz.workflow.WorkflowEngine"/>
<engine name="workflow" class="org.ofbiz.shark.service.SharkServiceEngine"/>
|
属性名
|
是否必须
|
描述
|
|
name
|
Y
|
服务引擎的名字,必须唯一
|
|
class
|
Y
|
GenericEngine接口的实现类
|
<!-- Name of the service to use for authorization -->
<authorization service-name="userLogin"/>
服务位置:
<service-location name="main-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
<service-location name="main-http" location="http://localhost:8080/webtools/control/httpService"/> <service-location name="entity-sync-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
<service-location name="entity-sync-http" location="http://localhost:8080/webtools/control/httpService"/> <service-location name="rita-rmi" location="rmi://localhost:1099/RMIDispatcher"/>
<service-location name="eedcc-test" location="http://localhost:8080/webtools/control/httpService"/>
<!-- Thread pool configuration (max/min threads, uses to live and time to live) -->
<thread-pool send-to-pool="pool"
purge-job-days="4"
failed-retry-min="3"
ttl="18000000"
wait-millis="750"
jobs="10"
min-threads="5"
max-threads="15"
poll-enabled="true"
poll-db-millis="20000">
<run-from-pool name="pool"/>
</thread-pool>
|
属性名
|
是否必须
|
描述
|
|
Ttl
|
Y
|
每个请求线程的存活时间。达到时间线程将被销毁
|
|
wait-millis
|
Y
|
每个请求线程在检查通过运行前休眠的时间
|
|
jobs
|
Y
|
每个请求线程在销毁之前可运行的工作数
|
|
min-threads
|
Y
|
线程池中保持的请求线程的最小数
|
|
max-threads
|
Y
|
线程池中将会创建请求线程的最大数
|
| poll-enabled | Y | 为‘true’scheduler就会poll数据库来调度工作 |
| poll-db-millis | Y | 如果线程池可用,本属性用来定义池化线程运行的频率 |
<service name="createNote" engine="java"
location="org.ofbiz.common.CommonServices" invoke="createNote">
<description>Create a new note record</description>
<attribute name="partyId" type="String" mode="INOUT" optional="true"/>
<attribute name="noteName" type="String" mode="IN" optional="true"/>
<attribute name="note" type="String" mode="IN" allow-html="safe"/>
<attribute name="noteId" type="String" mode="OUT"/>
</service>
|
属性
|
是否必须
|
说明
|
缺省值
|
|
name
|
Y
|
服务的唯一名称
|
|
|
engine
|
Y
|
引擎的名称(在serviceengine.xml中定义)
|
|
|
location
|
N
|
位置或服务包类的包名
|
|
|
invoke
|
N
|
服务的方法名
|
|
|
auth
|
N
|
服务是否要求授权?(true/false)
|
true
|
| debug | N | 当调用服务时,是否启动详细调试?(true/false) | true |
| default-entity-name | N | 使用自动属性(auto-attribute)的缺省实体 | |
| export | N | 这个服务是否允许通过SOAP/HTTP/JMS访问?(true/false) | false |
| validate | N | 是否对服务参数的名字和类型进行验证?(true/false) | true |
| max-retry | N | 异步调用服务失败时,最大重复次数 | -1(无限次) |
| use-transaction | N | 是否使用事务 | true |
| require-new-transaction | N | 在使用事务的情况下是否启动新事务 | true |
| semaphore | N | 并发调用服务时使用的信号量: none:当多个线程调用服务时,并发执行服务 wait:当多个线程调用服务时,采用排队的方法调用服务 fail:当服务正在被执行时,其他任何试图要调用该服务的线程都将调用失败 |
none |
| semaphore-wait-seconds | N | 当sempaphore="wait"时,调用服务的线程要等待的超时时间, 超时调用失败 |
300 |
| semaphore-sleep | N | 当sempaphore="wait"时,1毫秒内做几次检查 (检查服务能否被调用) |
300 |
| transaction-timeout | N | 该服务的事务超时时间,当该服务启动新事务才有效 | 0 |
|
属性
|
是否必须
|
描述
|
缺省值
|
|
name
|
Y
|
这个是属性的名字
|
|
|
type
|
Y
|
对象的类型(String,java.util.Date)等
|
|
|
model
|
Y
|
这个参数是输入、输出或输入输出(IN/OUT/INOUT)
|
|
|
optional
|
N
|
这个参数是否可选?(true/false)
|
false
|
|
default-value
|
N
|
默认值
|
|
| form-label | N | 对应的表单项显示名称 | |
| entity-name | N | 对象名 | |
| field-name | N | 属性名 | |
| string-map-prefix | N | Map类型参数的前缀 | |
| string-list-prefix | N | List类型参数的后缀 | |
| form-display | N | 是否在表单中显示?(true/false) | true |
我们参考几个service的定义看看service
<!-- simple condition implementation -->
<service name="effectiveDateEcaCondition" engine="java" auth="false" use-transaction="false"
location="org.ofbiz.service.ServiceUtil" invoke="genericDateCondition">
<implements service="serviceEcaConditionInterface"/>
<attribute name="fromDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
<attribute name="thruDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
</service>
参考二:applications/accounting/servicedef/services_finaccount.xml
<service name="refundGcPurchase" engine="java" require-new-transaction="true" use-transaction="true"
location="org.ofbiz.accounting.payment.GiftCertificateServices" invoke="refundGcPurchase" auth="true">
<description>Creates return for reload on failure</description>
<attribute name="orderItem" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
<attribute name="partyId" type="String" mode="IN" optional="false"/>
</service>
参考三:framework\service\servicedef\services.xml
<!-- Service Engine Services -->
<service name="purgeOldJobs" engine="java"
location="org.ofbiz.service.ServiceUtil" invoke="purgeOldJobs" auth="true" use-transaction="false" semaphore="wait">
<description>Cleans out old jobs which have been around longer then what is defined in serviceengine.xml</description>
<required-permissions join-type="AND">
<check-permission permission="SERVICE_INVOKE_ANY"/>
</required-permissions>
<!-- this service has no attributes -->
</service>
Apache OFBiz 学习笔记 之 服务引擎 一的更多相关文章
- Apache OFBiz 学习笔记 之 服务引擎 二
加载服务定义文件 ofbiz-component.xml:所有的服务定义文件在每个组件的ofbi-component.xml文件中 加载服务定义 例:framework/common/ofbi ...
- Apache OFBiz 学习笔记 之 实体引擎
1.概述 entity engine和常见的ORM有一点很大的不同,他的mapping object只有一个 GenericEntity,称它的entity engine 为adaptive ...
- Apache Flink学习笔记
Apache Flink学习笔记 简介 大数据的计算引擎分为4代 第一代:Hadoop承载的MapReduce.它将计算分为两个阶段,分别为Map和Reduce.对于上层应用来说,就要想办法去拆分算法 ...
- SpringCloud学习笔记:服务支撑组件
SpringCloud学习笔记:服务支撑组件 服务支撑组件 在微服务的演进过程中,为了最大化利用微服务的优势,保障系统的高可用性,需要通过一些服务支撑组件来协助服务间有效的协作.各个服务支撑组件的原理 ...
- Apache Ignite 学习笔记(一): Ignite介绍、部署安装和REST/SQL客户端使用
Apache Ignite 介绍 Ignite是什么呢?先引用一段官网关于Ignite的描述: Ignite is memory-centric distributed database, cachi ...
- Dubbo -- 系统学习 笔记 -- 示例 -- 服务分组
Dubbo -- 系统学习 笔记 -- 目录 示例 想完整的运行起来,请参见:快速启动,这里只列出各种场景的配置方式 服务分组 当一个接口有多种实现时,可以用group区分. <dubbo:se ...
- 树莓派学习笔记——Restful服务 采用slim php apache
0.前言 前些时间沉迷于Restful,采用PHP+Slim+MySQL实现了一些简单的API函数.但是这些工作都是在windows中实现(采用wamp server集成安装包),但是转到li ...
- Apache Lucene学习笔记
Hadoop概述 Apache lucene: 全球第一个开源的全文检索引擎工具包 完整的查询引擎和搜索引擎 部分文本分析引擎 开发人员在此基础建立完整的全文检索引擎 以下为转载:http://www ...
- Apache Hadoop学习笔记一
官网:http://hadoop.apache.org/ 1 什么是Hadoop? Apache™Hadoop®项目开发了用于可靠,可扩展的分布式计算的开源软件. Apache Hadoop软件库是一 ...
随机推荐
- hdu 4599 Dice 概率DP
思路: 1.求f[n];dp[i]表示i个连续相同时的期望 则 dp[0]=1+dp[1] dp[1]=1+(5dp[1]+dp[2])/6 …… dp[i]=1+(5dp[1 ...
- FileOutputStream和FileInputStream
package one.string; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFound ...
- mapreduce程序编写(WordCount)
折腾了半天.终于编写成功了第一个自己的mapreduce程序,并通过打jar包的方式运行起来了. 运行环境: windows 64bit eclipse 64bit jdk6.0 64bit 一.工程 ...
- ios APP屏幕快照尺寸
苹果上传APP审核需要上传APP屏幕快照,分别有3.5寸,4寸,4.7寸,5.5寸,ipad五种图片,对应尺寸大小: 3.5寸:横坚屏 640*960 或960*640 4寸:横坚屏 640*1036 ...
- C# Java间进行RSA加密解密交互(二)
原文:C# Java间进行RSA加密解密交互(二) 接着前面一篇文章C# Java间进行RSA加密解密交互,继续探讨这个问题. 在前面,虽然已经实现了C# Java间进行RSA加密解密交互,但是还是与 ...
- C++:概述
1.基本的输入输出,使用cin>>输入输入.使用cout<<输出 #include<iostream> using namespace std; int main( ...
- 机器学习 —— 概率图模型(Homework: MCMC)
除了精确推理之外,我们还有非精确推理的手段来对概率图单个变量的分布进行求解.在很多情况下,概率图无法简化成团树,或者简化成团树后单个团中随机变量数目较多,会导致团树标定的效率低下.以图像分割为例,如果 ...
- PCL—低层次视觉—点云分割(超体聚类)
1.超体聚类——一种来自图像的分割方法 超体(supervoxel)是一种集合,集合的元素是“体”.与体素滤波器中的体类似,其本质是一个个的小方块.与之前提到的所有分割手段不同,超体聚类的目的并不是分 ...
- 增加oracle数据库最大连接数
这几天碰到系统不能登陆的情况,初步判断可能是数据库连接满了,(后来检查不是这个原因),做了一次增加数据库最大连接数操作.操作步骤如下 操作系统:Red Hat Enterprise Linux Ser ...
- json格式的字符串转为json对象遇到特殊字符问题解决
中午做后台发过来的json的时候转为对象,可是有几条数据一直出不来,检查发现json里包含了换行符,造成这种情况的原因可能是编辑部门在编辑的时候打的回车造成的 假设有这样一段json格式的字符串 va ...