Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
0aad3215
Commit
0aad3215
authored
5 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SW-720
: using old implementation to connect to mom and send the xml specification
parent
ca6ab66e
No related branches found
No related tags found
1 merge request
!6
Import cobalt2 into lofar4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/SpecificationServices/lib/specification_service.py
+9
-8
9 additions, 8 deletions
SAS/SpecificationServices/lib/specification_service.py
with
9 additions
and
8 deletions
SAS/SpecificationServices/lib/specification_service.py
+
9
−
8
View file @
0aad3215
...
...
@@ -26,8 +26,10 @@ from io import BytesIO
from
lofar.common.util
import
waitForInterrupt
# TODO: mom.importxml uses old messaging interface
from
lofar.messagebus.message
import
MessageContent
from
lofar.messaging
import
RPCService
,
ToBus
,
EventMessage
,
DEFAULT_BROKER
,
DEFAULT_BUSNAME
,
\
from
lofar.messaging
import
RPCService
,
EventMessage
,
DEFAULT_BROKER
,
DEFAULT_BUSNAME
,
\
ServiceMessageHandler
from
lofar.messagebus.messagebus
import
ToBus
as
ToBusOld
from
lofar.messagebus.message
import
MessageContent
as
MessageContentOld
from
lofar.mom.momqueryservice.momqueryrpc
import
MoMQueryRPC
from
lofar.specificationservices.translation_service_rpc
import
TranslationRPC
from
lofar.specificationservices.validation_service_rpc
import
ValidationRPC
...
...
@@ -139,7 +141,6 @@ class SpecificationHandler(ServiceMessageHandler):
self
.
validationrpc
=
ValidationRPC
.
create
(
exchange
=
DEFAULT_BUSNAME
,
broker
=
DEFAULT_BROKER
)
self
.
specificationtranslationrpc
=
TranslationRPC
.
create
(
exchange
=
DEFAULT_BUSNAME
,
broker
=
DEFAULT_BROKER
)
self
.
momimportxml_bus
=
ToBus
(
exchange
=
MOMIMPORTXML_BUSNAME
,
broker
=
DEFAULT_BROKER
)
def
add_specification
(
self
,
user
,
lofar_xml
):
logger
.
info
(
"
got specification from user %s
"
,
user
)
...
...
@@ -253,18 +254,18 @@ class SpecificationHandler(ServiceMessageHandler):
def
_add_spec_to_mom
(
self
,
mom_xml
):
# Construct message payload using old-style (MessageBus) message format
msg
=
MessageContent
()
msg
=
MessageContent
Old
()
msg
.
protocol
=
"
mom.importxml
"
msg
.
from_
=
"
specification_service
"
msg
.
summary
=
"
Translated LOFAR specifications
"
msg
.
momid
=
-
1
msg
.
sasid
=
-
1
msg
.
payload
=
"
\n
%s
\n
"
# MoM needs enters around the payload to avoid "Content not allowed in prolog" error
content
=
msg
.
content
()
%
(
mom_xml
,)
msg
.
payload
=
"
\n
%s
\n
"
%
(
mom_xml
,
)
# MoM needs enters around the payload to avoid "Content not allowed in prolog" error
emsg
=
EventMessage
(
subject
=
MOMIMPORTXML_SUBJECT
,
content
=
content
)
with
self
.
momimportxml_bus
:
self
.
momimportxml_bus
.
send
(
emsg
)
#emsg = MessageOld(subject=MOMIMPORTXML_SUBJECT, content=content)
with
ToBusOld
(
queue
=
MOMIMPORTXML_BUSNAME
,
broker
=
DEFAULT_BROKER
)
as
momimportxml_bus
:
momimportxml_bus
.
send
(
msg
)
logger
.
debug
(
"
Send specs to MOM: %s
"
,
mom_xml
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment