Difference between revisions of "Data Transfer Common Messaging"
(→Scenario) |
m |
||
Line 1: | Line 1: | ||
+ | <!-- CATEGORIES --> | ||
+ | [[Category:Developer's Guide]] | ||
+ | <!-- END CATEGORIES --> | ||
= Common Messaging Interface = | = 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. | The Common Messaging Interface has been implemented so that messaging can be integrated from other Components such as scheduler and agent service. |
Latest revision as of 17:46, 11 July 2013
Contents
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 an MSGClient used both in agent and scheduler service for producing a message.
// **** Setting MSG Client **** ScopeProvider.instance.set(scope.toString()); try { msgClient = MSGClientFactory.getMSGClientInstance(); } catch (Exception e) { e.printStackTrace(); }
For the subscription, the scheduler and agent should follow respectively the following (where sourceEndpoint is the subscriber's endpoint):
// **** Scheduler Subscription **** TransferResponseSubscription subscriber = new TransferResponseSubscription(sourceEndpoint); subscriber.setScope(scope); try { subscriber.subscribe(); } catch (Exception e) { e.printStackTrace(); } // **** Agent Subscription **** TransferRequestSubscription subscriber = new TransferRequestSubscription(sourceEndpoint); subscriber.setScope(scope); try { subscriber.subscribe(); } catch (Exception e) { e.printStackTrace(); }
For producing a message:
TransferRequestMessage transferRequestMessage = new TransferRequestMessage(); //transferRequestMessage.set blah blah... set all the appropriate info //... transferRequestMessage.createTopicNname(scope); // **** Send a request message **** try { msgClient.sendRequestMessage(context, transferRequestMessage, scope); }catch (Exception e) { e.printStackTrace(); }