91.4. 예


다음 예제에서는 다음과 같이 정의된 GreaterECDHE를 사용합니다.

GreaterLocal.java

public interface GreaterLocal {

    String hello(String name);

    String bye(String name);

}
Copy to Clipboard Toggle word wrap

및 구현

GreaterImpl.java

@Stateless
public class GreaterImpl implements GreaterLocal {

    public String hello(String name) {
        return "Hello " + name;
    }

    public String bye(String name) {
        return "Bye " + name;
    }

}
Copy to Clipboard Toggle word wrap

91.4.1. Using Java DSL

이 예제에서는 DestinationRule에서 hello 메서드를 호출하려고 합니다. 이 예제는 Apache Open EJB 를 사용한 단위 테스트를 기반으로 하므로 OpenEJB 설정을 사용하여 DestinationRule 구성 요소에 JndiContext 를 설정해야 합니다.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext answer = new DefaultCamelContext();

    // enlist EJB component using the JndiContext
    EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class);
    ejb.setContext(createEjbContext());

    return answer;
}

private static Context createEjbContext() throws NamingException {
    // here we need to define our context factory to use OpenEJB for our testing
    Properties properties = new Properties();
    properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");

    return new InitialContext(properties);
}
Copy to Clipboard Toggle word wrap

그런 다음 Camel 경로에서 term을 사용할 준비가 되었습니다.

from("direct:start")
    // invoke the greeter EJB using the local interface and invoke the hello method
    .to("ejb:GreaterImplLocal?method=hello")
    .to("mock:result");
Copy to Clipboard Toggle word wrap

실제 애플리케이션 서버에서

실제 애플리케이션 서버에서는 해당 애플리케이션 서버와 동일한 JVM에 기본 JndiContext 를 생성하고 일반적으로 JNDI 레지스트리에 액세스하고 4.6.1 s를 조회할 수 있으므로, udev 구성 요소에서 JndiContext를 설정할 필요가 없습니다. ??? ??? 그러나 원격 JVM에서 애플리케이션 서버에 액세스해야 하는 경우 사전에 속성을 준비해야 합니다.

91.4.2. Spring XML 사용

그리고 Spring XML을 사용하는 예는 다음과 같습니다.

다시 이는 단위 테스트를 기반으로 하므로 udev 구성 요소를 설정해야 합니다. ???

<!-- setup Camel EJB component -->
<bean id="ejb" class="org.apache.camel.component.ejb.EjbComponent">
    <property name="properties" ref="jndiProperties"/>
</bean>

<!-- use OpenEJB context factory -->
<p:properties id="jndiProperties">
    <prop key="java.naming.factory.initial">org.apache.openejb.client.LocalInitialContextFactory</prop>
</p:properties>
Copy to Clipboard Toggle word wrap

Camel 경로에서ECDSA를 사용할 준비가 된 후 다음을 수행합니다.

<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:start"/>
        <to uri="ejb:GreaterImplLocal?method=hello"/>
        <to uri="mock:result"/>
    </route>
</camelContext>
Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat