Difference between revisions of "Data Transfer Common Messaging"
(→Common Messaging Interface) |
m |
||
(14 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | <!-- CATEGORIES --> | |
− | + | [[Category:Developer's Guide]] | |
− | + | <!-- END CATEGORIES --> | |
+ | = 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. | ||
− | + | ||
+ | == Common Messaging == | ||
+ | |||
=== Messages === | === Messages === | ||
− | + | ||
*TransferRequestMessage: | *TransferRequestMessage: | ||
− | This message holds information about the transfer details that | + | 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: | *TransferResponseMessage: | ||
− | On the other side the transfer response message holds details about the submitted transfer. | + | 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 === | === 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. | ||
+ | |||
+ | <source lang="java5"> | ||
+ | // **** Setting MSG Client **** | ||
+ | ScopeProvider.instance.set(scope.toString()); | ||
+ | try { | ||
+ | msgClient = MSGClientFactory.getMSGClientInstance(); | ||
+ | } catch (Exception e) { | ||
+ | e.printStackTrace(); | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | For the subscription, the scheduler and agent should follow respectively the following | ||
+ | (where sourceEndpoint is the subscriber's endpoint): | ||
+ | <source lang="java5"> | ||
+ | // **** 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(); | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | For producing a message: | ||
+ | <source lang="java5"> | ||
+ | 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(); | ||
+ | } | ||
+ | </source> |
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(); }