Name: system-of-record
Owner: HM Land Registry
Description: Beta version of the system of record
Created: 2015-01-22 12:26:36.0
Updated: 2016-01-27 12:01:00.0
Pushed: 2016-03-30 11:12:41.0
Homepage: null
Size: 1521
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
At the moment this service posts data to a postgres database.
ant up
ant ssh
vagrant
ce ~/venvs/system-of-record/bin/activate
n.sh -d
Note: Occasionally there is an issue starting Rabbitmq if you are already running a Register Publisher VM.
In virtual machine
st.sh
vagrant
n-tester.sh -d
http://127.0.0.1:5002/count
http://127.0.0.1:5002/getlastrecord
http://127.0.0.1:5002/deletelastrecord
http://127.0.0.1:5002/getnextqueuemessage
Note: Use 0.0.0.0 when running from host. Use 10.0.2.2 when calling from another VM.
-X POST -d '{"sig":"some_signed_data","data":{"title_number": "DN1", "application_reference":"ABR123"}}' -H "Content-Type: application/json" http://127.0.0.1:5001/insert
-X POST -d '{"titles": [{"title_number":"DN1"}]}' -H "Content-Type: application/json" http://127.0.0.1:5001/republish
-X POST -d '{"titles": [{"title_number":"DN1", "application_reference": "ABR123"}]}' -H "Content-Type: application/json" http://127.0.0.1:5001/republish
-X POST -d '{"titles": [{"title_number":"DN1", "application_reference": "ABR123", "geometry_application_reference": "GEO123"}]}' -H "Content-Type: application/json" http://127.0.0.1:5001/republish
-X POST -d '{"titles": [{"title_number":"DN1", "application_reference": "ABR123"}, {"title_number":"DN2", "application_reference": "ABR1234"}, {"title_number":"DN3", "application_reference": "ABR12345"} ]}' -H "Content-Type: application/json" http://127.0.0.1:5001/republish
-X POST -d '{"titles": [{"title_number":"DN1", "all_versions":true}]}' -H "Content-Type: application/json" http://127.0.0.1:5001/republish
http://127.0.0.1:5001/republish/everything
The republisheverything endpoint creates a 'republish_progress.json' file. This file is populated with a count value
and the last id on the target database. After the file is created, a thread iterates through the system of record database 100 rows at a time and writes the json record and title number to the 'register_publisher' queue.
When the 'last_id' value is reached, the file will be deleted.
The threads are spawned in republish_all.py, which is called in the init of the flask app.
http://127.0.0.1:5001/
Status of the server
ice rabbitmq-server status
Stop the server
ice rabbitmq-server stop
Start the server
ice rabbitmq-server start
List queues, and show queue detail
itmqadmin list queues
or
rabbitmqctl list_queues
put a message on the queue:
itmqadmin publish exchange=amq.default routing_key=system_of_record payload="hello, world"
ce ./environment.sh
on3 manage.py db upgrade
-i
-U systemofrecord systemofrecord
The main table in the systemofrecord database is called records. To describe this table use the following command
ecords
To query, update, delete from the table use sql.
ct * from records;