2012-10-19 2 views
0

하나의 애플리케이션에서 다른 애플리케이션으로 데이터를 전송할 애플리케이션을 개발하고 싶습니다. 이제는 내 응용 프로그램 중 하나가 .Net 프레임 워크에 있고, 다른 하나는 Spring 프레임 워크 (Java)에서 구현된다는 것입니다.

이런 종류의 환경에 가장 적합한 프로그래밍 기법은 무엇입니까?
그리고 예! 데이터가 매우 무겁습니다, 그것은 BLOBs를 포함합니다. 또한 전송 중에 네트워크가 끊어 질 가능성이 있으므로 트랜잭션과 같은 것이어야합니다. 나는 확실히 데이터를 잃고 싶지 않기 때문에.

http를 통한 XML에 대해 어떻게 생각하십니까?

데이터 전송을 위해 어떤 종류의 응용 프로그램을 구현해야하는지 제안하십시오.분산 환경의 미들웨어 애플리케이션

답변

1

Java를 사용하여 JMS는 데이터를 제공하는 전송 계층에서 응용 프로그램을 분리하는 방법을 제공합니다. 동일한 Java 클래스를 사용하여 원하는 공급자에 대한 JNDI 정보를 사용하여 다른 JMS 공급자와 통신 할 수 있습니다. 클래스는 먼저 연결 팩토리를 사용하여 대기열 또는 항목에 연결 한 다음 채우기를 사용하고 메시지를 보내거나 게시합니다. 수신 측에서는 클라이언트가 메시지를 받거나 구독합니다.

내가 SonicMQ messaging system을 사용했습니다, 자신의 Java Message Services이 매우 안정적입니다 ... 당신은 내가 그것을 here을 사용하고 방법에 대한 약간의 샘플을 볼 수 있습니다 및 법전 편찬은 매우 간단 될 수있는 .Net implementation

가 :

/** 
* 
* This file is part of Jms.publisher sample. 
* 
* Jms.publisher is free software: you can redistribute it and/or modify 
* it under the terms of the GNU General Public License as published by 
* the Free Software Foundation, either version 3 of the License, or 
* (at your option) any later version. 
* 
* Jms.publisher is distributed in the hope that it will be useful, 
* but WITHOUT ANY WARRANTY; without even the implied warranty of 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
* GNU General Public License for more details. 
* 
* You should have received a copy of the GNU General Public License 
* along with Jms.publisher. If not, see <http://www.gnu.org/licenses/>. 
* 
* 
* AccessManager.Java 
* Create by Iván Jaimes on 03/09/2012 
* 
*/ 
package sonic; 

import javax.jms.JMSException; 
import javax.jms.Session; 
import javax.jms.TextMessage; 
import javax.jms.TopicConnection; 
import javax.jms.TopicPublisher; 
import javax.jms.TopicSession; 
import javax.jms.TopicConnectionFactory; 

import config.ConnectionInfo; 

public class AccessManager 
{ 
    private TopicConnection connection = null; 
    private TopicSession session = null; 
    private TopicPublisher topicPublisher = null;  
    private TopicConnectionFactory connectionFactory = null; 
    private ConnectionInfo info = null; 

    public AccessManager(ConnectionInfo connectionInfo) throws JMSException 
    { 
     info = connectionInfo; 
    } 

    public final void connect() throws JMSException 
    { 
     connectionFactory = new progress.message.jclient.TopicConnectionFactory(info.getSonicAddress()); 
     connection = connectionFactory.createTopicConnection(info.getUserName(), info.getPassword()); 
     connection.start(); 
     session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); 
     topicPublisher = session.createPublisher(info.getTopic()); 
     assert (isConnected()); 
    } 

    public void send(String text) throws JMSException 
    { 
     TextMessage message = session.createTextMessage(text); // send method 
     topicPublisher.publish(message); 
    } 
    /** 
    * Disconnect. 
    * @throws JMSException 
    */ 
    public final void disconnect() throws JMSException 
    { 
     if (topicPublisher != null) 
     { 
      topicPublisher.close(); 
      session.close(); 
      connection.close(); 
     } 

     connection = null; 
     session = null; 
    } 

    /** 
    * Checks if is connected. 
    * 
    * @return true, if is connected 
    */ 
    public final boolean isConnected() { 
     if (session != null) { 
      return true; 
     } 
     return false; 
    } 
} 

그것에 대해 더 많은 자원이 있습니다