Difference between revisions of "Data Transfer Common Messaging"

From Gcube Wiki
Jump to: navigation, search
(Common Messaging Interface)
(Common Messaging Interface)
Line 19: Line 19:
 
Just to give a initial overview of the API the following is a simple code snippet which initialize a MSGClient used both in agent and scheduler service for producing a message.  
 
Just to give a initial overview of the API the following is a simple code snippet which initialize a MSGClient used both in agent and scheduler service for producing a message.  
  
<source lang="java6">
+
<source lang="java5">
 
// **** Setting MSG Client ****
 
// **** Setting MSG Client ****
 
ScopeProvider.instance.set(scope.toString());
 
ScopeProvider.instance.set(scope.toString());
Line 30: Line 30:
  
 
For the subscription, the scheduler and agent should follow respectively the following:  
 
For the subscription, the scheduler and agent should follow respectively the following:  
<source lang="java6">
+
<source lang="java5">
 
// **** Scheduler Ssubscription ****
 
// **** Scheduler Ssubscription ****
 
TransferResponseSubscription subscriber = new TransferResponseSubscription(sourceEndpoint);
 
TransferResponseSubscription subscriber = new TransferResponseSubscription(sourceEndpoint);

Revision as of 17:49, 18 March 2013

Common Messaging Interface

The Common Messaging Interface has been implemented so that messaging can be integrated from other Components such as scheduler and agent service.

Common Messaging

Messages


  • TransferRequestMessage:

This message holds information about the transfer details that scheduler submits to agent service. Provided information can be input uri's, destination folder, transfer options etc.

  • TransferResponseMessage:

On the other side the transfer response message holds details about the submitted transfer. This message will be sent until the transfer has been completed (whatever that status will be) and the receiver is able to see the bytes that already have been transferred the status etc.

Messages Queues

TransfeRequest queue specified by the endpoint of the agent destination TransferResponse queue

Scenario


Just to give a initial overview of the API the following is a simple code snippet which initialize a MSGClient used both in agent and scheduler service for producing a message.

// **** Setting MSG Client ****
ScopeProvider.instance.set(scope.toString());
try {
	ServiceContext.getContext().setMsgClient(MSGClientFactory.getMSGClientInstance());
} catch (Exception e) {
	e.printStackTrace();
}

For the subscription, the scheduler and agent should follow respectively the following:

// **** Scheduler Ssubscription ****
TransferResponseSubscription subscriber = new TransferResponseSubscription(sourceEndpoint);
subscriber.setScope(scope);
try {
	subscriber.subscribe();
} catch (Exception e) {
	e.printStackTrace();
}			
 
// **** Agent Ssubscription ****
TransferRequestSubscription subscriber = new TransferRequestSubscription(sourceEndpoint);
subscriber.setScope(scope);
try {
	subscriber.subscribe();
} catch (Exception e) {
	e.printStackTrace();
}