将警报作为Oracle Service Bus自定义文件插入

时间:2016-04-01 07:33:03

标签: oracle osb alerts

我正在为OSB创建一个自定义文件,我需要在此添加一个警报,因此无论何时加载,都会修改受影响的资源以包含这些警报。

到目前为止,我已按照See Example - Adding and Deleting SLA Alert Rules中说明的说明进行操作。我创建了一个自定义文件,其结构与示例相同(actions - add - value),只是更改警报的值,甚至使用示例中显示的值。

无论如何,当我尝试在OSB上应用这个自定义文件时,我总是得到错误:
org.apache.xmlbeans.impl.values.XmlAnyTypeImpl无法强制转换为 com.oracle.xmlns.servicebus.monitoring.alert.AlertRuleDocument

我的自定义文件是:

Public Sub effectiveDate() Handles DataGridViewsalarydetail.CellEndEdit
    'Get current RowIndex and ColumnIndex
    Dim row As Integer = DataGridViewsalarydetail.CurrentCell.RowIndex
    Dim column As Integer = DataGridViewsalarydetail.CurrentCell.ColumnIndex()

    If column = 1 Then 'If you are currently in the second column of the datagridview
        If IsDate(DataGridViewsalarydetail.Rows(row).Cells(column).Value) = False Then
            MsgBox("The date of the " & row & " row is not correct")
            Dim cell As Windows.Forms.DataGridViewCell = DataGridViewsalarydetail.Rows(row).Cells(column)
            'Focus the cell 
            DataGridViewsalarydetail.CurrentCell = cell
            DataGridViewsalarydetail.BeginEdit(True)
        End If
    End If
End Sub

有谁知道如何解决这个问题,或者我做得不好?

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

最后,我使用如下警告制作了一个自定义文件:

<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes" xmlns:aler="http://xmlns.oracle.com/servicebus/monitoring/alert">
<cus:customization xsi:type="cus:EnvValueActionsCustomizationType">
    <cus:description>Alertes Generals de ProxyService</cus:description>
    <cus:owners>
        <xt:ownerQuery>          
            <xt:resourceTypes>ProxyService</xt:resourceTypes>
            <xt:refsToSearch xsi:type="xt:LocationRefType">
                <xt:type>Folder</xt:type>
                <xt:path>bus_ver/EA</xt:path>
            </xt:refsToSearch>                                                       
        </xt:ownerQuery>
    </cus:owners>
    <cus:actions>
        <xt:replace>
            <xt:envValueType>Service SLA Alert Rule List</xt:envValueType>
            <xt:value>
                <aler:alertRules>
                    <aler:alertRule enabled="true" name="prova" xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:con="http://www.bea.com/wli/sb/services/security/config" xmlns:oper="http://xmlns.oracle.com/servicebus/proxy/operations" xmlns:env="http://www.bea.com/wli/config/env" xmlns:tran="http://www.bea.com/wli/sb/transports">
                        <aler:description>provades</aler:description>
                        <aler:expirationDate>2016-03-31+02:00</aler:expirationDate>
                        <aler:startTime>00:00:00.000+01:00</aler:startTime>
                        <aler:endTime>00:05:00.000+01:00</aler:endTime>
                        <aler:frequency>every-time</aler:frequency>
                        <aler:severity>normal</aler:severity>
                        <aler:stopProcessing>false</aler:stopProcessing>
                        <aler:condition aggregation-interval="10">
                            <con1:monCondExpr xmlns:con1="http://xmlns.oracle.com/servicebus/monitoring/alert/condition">
                                <con1:function>count</con1:function>
                                <con1:lhs>Operation.peticionSincrona.error-count</con1:lhs>
                                <con1:operator>=</con1:operator>
                                <con1:rhs>1</con1:rhs>
                            </con1:monCondExpr>
                        </aler:condition>
                        <aler:alertDestination ref="bus_ver/AlertaProva"/>
                    </aler:alertRule>
                </aler:alertRules>
            </xt:value>
        </xt:replace>
    </cus:actions>
</cus:customization>

在初始XML中引发错误的主要差异:

  • xmlns:aler =“http://xmlns.oracle.com/servicebus/monitoring/alert” - &gt; OK vs xmlns:aler =“http://www.bea.com/wli/monitoring/alert” - &gt; KO
  • 服务SLA警报规则列表 - &gt;确定与服务SLA警报规则 - &gt; KO